javascript library for free form drawing

2019-06-22 08:22发布

Is there a javascript library which lets me draw on a web page and then save the state of that drawing?

I want to draw an 2D image using the mouse and then how to store and load that drawing

3条回答
够拽才男人
2楼-- · 2019-06-22 09:04

You should look at ProcessingJS.

查看更多
混吃等死
3楼-- · 2019-06-22 09:05

Use HTML5 Canvas. A simple example for drawing images is here: http://jsfiddle.net/ghostoy/wTmFE/1/.

I recommend this online book: Dive Into HTML5.

查看更多
爷、活的狠高调
4楼-- · 2019-06-22 09:20

If you want the free drawing to work with touchscreens, I recommend Fabric.js:

Code:

<canvas id="c1" width="100" height="100" style="border:1px solid black;">
</canvas>

var canvas = new fabric.Canvas('c1');
canvas.isDrawingMode = true;
canvas.freeDrawingBrush.width = 5;
console.log(canvas);

See JSfiddle

查看更多
登录 后发表回答