html canvas

it2022-05-05  166

canvas

context.beginPath:开始新的路径

context.closePath:结束路径:创建一个从开始到结束的路径

context.moveTo(x,y);创建新的子路径,规定起点为(x,y)

context.lineTo(x,y):为子路径添加一条直线从当前点开始(x,y)结束

context.fill() :填充,如果路径未封闭,从开始点到结束点创建路径,变成密闭状态

fillStyle

strokeStyle

先endPath后stroke();

 

创建曲线


arc()

context.arc(x,y,r,sAngle,eAngle,anticlockwise)

x:圆心x坐标

y:圆心y坐标

sAngle:起始角度

eAngle:终止角度

 

创建矩形


rect(x,y,width,height);

fillRect(x,y,width,height);

 

转载于:https://www.cnblogs.com/zhangchunqing/p/10669407.html


最新回复(0)