$("#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); });
I want to realize the function of the pointer (pin.png) rotating on the turntable (pan.png), but if ctx.clearRect(); will appearAs shown in the figure; The result I want is
, how to achieve it? ? Ask for advice
Due to insufficient information, I can only give my judgment.
png is not transparent, the probability is very small
You are divided into two canvases, but the canvas with the pointer has a background color, the probability is also very small
Code problem: