"bubbles"
Bootstrap 4.0.0 Snippet by mpmsameer

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <html> <body> <canvas id="mc" width="400" height="300" style="border:1px solid black"> </canvas> <script> var canvas; var ctx; var x=400; var y=300; var dx=2; var dy=4; var width=400; var height=300; function circle() { ctx.beginPath(); ctx.fillStyle="red"; ctx.arc(x,y,30,0,Math.PI*2,true); ctx.fill(); ctx.closePath(); } function Clear() { ctx.clearRect(0,0,width,height); } function init() { canvas=document.getElementById("mc"); ctx=canvas.getContext("2d"); return setInterval(draw, 15); } function draw() { Clear(); circle(); if (x > width || x < 0) dx=-dx; if(y>height||y<0) dy= -dy; x+=dx; y+=dy; } init(); </script> </body> </html>
var canvas; var ctx; var x=400; var y=300; var dx=2; var dy=4; var width=400; var height=300; function circle() { ctx.beginPath(); ctx.fillStyle="red"; ctx.arc(x,y,30,0,Math.PI*2,true); ctx.fill(); ctx.closePath(); } function Clear() { ctx.clearRect(0,0,width,height); } function init() { canvas=document.getElementById("mc"); ctx=canvas.getContext("2d"); return setInterval(draw, 15); } function draw() { Clear(); circle(); if (x > width || x < 0) dx=-dx; if(y>height||y<0) dy= -dy; x+=dx; y+=dy; } init();

Related: See More


Questions / Comments: