首先,就上述绘制弧线的章节进行一个小小的补充: 如果我们使用了context.beginPath();紧接着后面的context.moveTo(x,y),可以改为context.lineTo(x,y)效果是一样的: 好了,现在来开始我们这一章的内容了 编写一个绘制矩形的接口函数 <script type=text/javascript> var canvas=document.getElementById("canvas"); var context=canvas.getC…
首先说一下canvas类: Class Overview The Canvas class holds the "draw" calls. To draw something, you need 4 basic components: A Bitmap to hold the pixels, a Canvas to host the draw calls (writing into the bitmap), a drawing primitive (e.g. Rect, Path, t…