<canvas id="canvas" width="500px" height="500px" style="border:1px solid #ddd"></canvas>
<script>
var context=document.getElementById("canvas").getContext('2d');
context.translate(250,250);
context.fillStyle="lightblue";
var d=Math.PI/180*30;
var x=0.9,y=0.9;
timer=setInterval(function(){
context.clearRect(-canvas.width/2,-canvas.height/2,canvas.width,canvas.height);
context.rotate(d);
context.scale(x,y);
context.fillRect(-125,-125,250,250);
},100)
</script>
现在这种效果都可以用css3搞定了吧
你是DA NEI的? 我们今天学的就是这个,代码都一样的
需要多大的程度,你可以在setInterval里面去判断的。