Two.js 介绍
Two.js 是一个二维的绘图 API,用于较新的 Web 浏览器,可基于不同上下文绘制,包括 svg、canvas 和 webgl。
示例代码:
// 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();
Two.js 官网
http://jonobr1.github.io/two.js/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。