基于Web的2D绘图:Two.js

jopen 11年前

Two.js是一个面向现代浏览器的2D绘图API。对于不同的浏览器渲染引擎(svg, canvas, 和webgl),提供了相同的绘制API。
基于Web的2D绘图:Two.js
用法:

// Make an instance of two and place it on the page.  var elem = document.getElementById('draw-shapes').children[0];  var params = { width: 285, height: 200 };  var two = new Two(params).appendTo(elem);    // two has convenience methods to create shapes.  var circle = two.makeCircle(72, 100, 50);  var rect = two.makeRectangle(213, 100, 100, 100);    // The object returned has many stylable properties:  circle.fill = '#FF8000';  circle.stroke = 'orangered'; // Accepts all valid css color  circle.linewidth = 5;    rect.fill = 'rgb(0, 200, 255)';  rect.opacity = 0.75;  rect.noStroke();

项目主页:http://www.open-open.com/lib/view/home/1367978382293