使用arc方法Javascript旋转椭圆

时间:2019-10-30 04:34:35

标签: javascript html canvas

使用上下文弧方法,我需要在画布上旋转弧。

ctx.save(); 
ctx.beginPath();
ctx.translate(cx-rx, cy-ry);
ctx.scale(rx, ry);
ctx.rotate(angle * Math.PI / 180); // angle = 45 will move away from the cordinates
ctx.arc(1, 1, 1, 0, 2 * Math.PI, false);
ctx.restore(); 
ctx.stroke();
ctx.restore();

0 个答案:

没有答案