n3f0jg
Last Updated: November 13, 2017
·
7
· medo100s

my circle in canvas animation doesn't want to move on

i m trying my first practice in canvas js/html but it doesn't work with me here is my code :
html :
<html lang="us">

<head>
<style type="text/css">
canvas {
border: black solid 2px;
}
body{
margin: 0px;
}
</style>

</head>
<body>
<canvas > </canvas>
<script src="animateC.js"></script>

</body>

</html>

//here is my code JS
var canvas = document.querySelector('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var c = canvas.getContext('2d');

var x = 200;
function animate()
{ requestAnimationFrame(animate);
c.beginPath();
c.arc(x,200,30,0,Math.PI * 2, false);
c.strokeStyle = "red";
c.stroke();
x+=1;

}

Say Thanks
Respond