<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
无标题文档 body{ background:black; } #c1{ background:white; } span{ color:white; } window.onload=function() { var oC = document.getElementById("c1") ; var oGC = oC.getContext('2d') ; var num = 0; oGC.translate(100,100); setInterval(function(){ num++; oGC.save(); oGC.clearRect(0,0,oC.width,oC.height); oGC.rotate(num*Math.PI/180); oGC.fillRect(0,0,100,100); oGC.restore(); },30); }
不支持canvas浏览器
做了一个以坐标(100,100)为中心点旋转的小方块,显示效果不正常,请各位老师指教哪里有错误,谢谢!