javascript library for free form drawing

ぃ、小莉子 提交于 2019-12-10 15:12:02

问题


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


回答1:


You should look at ProcessingJS.




回答2:


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.




回答3:


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

  • Demo
  • Tutorial

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



来源:https://stackoverflow.com/questions/6770899/javascript-library-for-free-form-drawing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!