Hello. It is necessary to draw with the help of Canvas and JavaScript animation of the falling primitive. So here. How to make it so that it does not leave the previous state?
Code snippet
var ctx = document.querySelector("canvas").getContext('2d'); ctx.lineWidth = 2; function draw() { var y = 0; function frame() { ctx.beginPath(); ctx.arc(100, 100+y, 20, 0, 2*3.14); ctx.stroke(); ctx.fill(); ctx.closePath(); y+=5; if (y >= 100) clearTimeout(timer); } var timer = setInterval(frame, 50); } draw(); <canvas width=200 height=200> </canvas> I can provide all the code if necessary. What happened:

setInterval...clearTimeout- bug. - Qwertiy ♦ctx.save(); ctx.restore()ctx.save(); ctx.restore()? - Desmond Fox