$("#bt-lottery").one("click",function(){ var reg=1; setInterval(function(){ ctx.save(); ctx.translate(249.5,249.5);//將原點(diǎn)移動(dòng)到畫布中心 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); });我想要實(shí)現(xiàn)指針(pin.png)在轉(zhuǎn)盤上(pan.png)旋轉(zhuǎn)的功能,但是如果ctx.clearRect();就會(huì)出現(xiàn)如圖的情況;我想要的結(jié)果是,該怎么實(shí)現(xiàn)呢??求教
關(guān)于canvas旋轉(zhuǎn)
九州編程
2018-11-13 13:13:12