1.首先说一下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,…
前段时间由于项目需要,用到了HTML5 Canvas画图,但是没有画虚线的方法,自己写了一个HTML5 画虚线的组件. dashedLine.js if (window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype.lineTo) { CanvasRenderingContext2D.prototype.dashedLine = function (x, y, x2, y2, dashArray) { if (…