首页 > 解决方案 > 使用弧法Javascript旋转椭圆

问题描述

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

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();

标签: javascripthtmlcanvas

解决方案


推荐阅读