2021年2月25日

绘制矩形

摘要: 示例1、绘制一个矩形 var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.strokeStyle="#0000ff"; ctx.strokeRect(20,20,150,100); 示例二、绘制渐变矩形 阅读全文

posted @ 2021-02-25 13:47 zhishiyv 阅读(118) 评论(0) 推荐(0) 编辑

绘制线条

摘要: 绘制线条 // Get the context context = document.getElementById("cvs").getContext('2d'); // Anti aliasing fix. This makes the lines look crisp and sharp and 阅读全文

posted @ 2021-02-25 11:53 zhishiyv 阅读(71) 评论(0) 推荐(0) 编辑

画直线

摘要: A const ctx = wx.createCanvasContext('myCanvas'); ctx.beginPath(); ctx.setLineCap('butt'); ctx.moveTo(10, 10); ctx.setLineWidth(10); ctx.lineTo(150,10 阅读全文

posted @ 2021-02-25 11:21 zhishiyv 阅读(37) 评论(0) 推荐(0) 编辑

画弧线

摘要: HTML5 canvas arc( )方法 arc()方法创建弧、曲线 (用于创建圆或部分圆) 提示:如需通过arc( ) 来创建圆。请把起始角设置为0,结束角设置为2*Math.PI 提示:请使用stroke或fill()方法在画布上绘制实际的弧 语法: context.arc(x,y,r,sAn 阅读全文

posted @ 2021-02-25 09:35 zhishiyv 阅读(138) 评论(0) 推荐(0) 编辑

绘制贝塞尔曲线

摘要: 绘制一条贝塞尔曲线 var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.moveTo(20,20); ctx.bezierCurveTo(20,100,200,100, 阅读全文

posted @ 2021-02-25 09:23 zhishiyv 阅读(333) 评论(0) 推荐(0) 编辑

导航