摘要: 效果图: 知识点: 1、ctx.save(); //保存ctx状态 ctx.restore();//回到之前ctx的状态 一般ctx.save()与ctx.restore()是成对出现的,比如我们在绘图的时候需要使用多种颜色,颜色需要不时的切换。那么使用save()和restore()方法即可比较方 阅读全文
posted @ 2019-11-21 22:00 梁涛999 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 效果图: 知识点: 1、五角星顶点坐标 (r*cos(deg)+x,-r*sin(deg)+y) 2、画圆 ctx.arc(x,y,r,0,2*Math.PI); //后两个参数开始弧度,结束弧度。0表示开始弧度为3点钟方向,0.5PI为90度。 代码: <!DOCTYPE html> <html> 阅读全文
posted @ 2019-11-21 21:06 梁涛999 阅读(505) 评论(0) 推荐(0) 编辑
摘要: 效果图: 知识点: 1、context.beginPath(); 2、context.closePath(); 3、context.Rect(x,y,width,heght); context.fllRect(x,y,width,heght); context.strokeRect(x,y,widt 阅读全文
posted @ 2019-11-21 21:05 梁涛999 阅读(150) 评论(0) 推荐(0) 编辑