JS绘图库 Fabric.js
openkk
13年前
Fabric.js 是一个在服务器端运行的 Node.js 扩展模块,用于在Web上绘制各种图形的 JS 库。
示例代码:
var fabric = require('fabric').fabric, canvas = fabric.createCanvasForNode(200, 200); canvas.add(new fabric.Rect({ top: 100, left: 100, width: 100, height: 50, angle: 30, fill: 'rgba(255,0,0,0.5)' })); var out = require('fs').createWriteStream(__dirname + '/rectangle.png'), stream = canvas.createPNGStream(); stream.on('data', function(chunk) { out.write(chunk); });