html canvas

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

 

posted @ 2019-04-08 11:17  Chesney张帅  阅读(98)  评论(0编辑  收藏  举报