$("#bt-lottery").one("click",function(){ var reg=1; setInterval(function(){ ctx.save(); ctx.translate(249.5,249.5);//將原點移動到畫布中心 ctx.rotate(reg*Math.PI/180); ctx.clearRect(-pin.width/2,-pin.height/2,pin.width,pin.height); ctx.drawImage(pin,-pin.width/2,-pin.height/2); ctx.restore(); reg++; },5); });我想要實現指針(pin.png)在轉盤上(pan.png)旋轉的功能,但是如果ctx.clearRect();就會出現如圖的情況;我想要的結果是,該怎么實現呢??求教
關于canvas旋轉
九州編程
2018-11-13 13:13:12