所以我有这个代码,我想制作一个simlpe动画,但我似乎无法弄清楚它为什么不起作用。我只想通过改变圆的半径来玩动画。
function DrawCircle () {
ctx.clearRect(0, 0, canvasHeight, canvasWidth);
ctx.beginPath();
this.y = 200;
this.circle_radius = 150;
//Create circle
ctx.arc(200, this.y, this.circle_radius, 0, Math.PI * 2, false);
ctx.fillStyle="#265D6D";
ctx.fill();
ctx.closePath();
};
var requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame;
var test = new DrawCircle();
function moving(test) {
test.circle_radius =+ 50;
window.requestAnimationFrame(moving);
};
moving(test);