2D绘图库 two.js

安装

wget https://raw.github.com/jonobr1/two.js/master/build/two.js
wget https://raw.github.com/jonobr1/two.js/master/build/two.min.js

npm install -D two.js

Two实例

let app = document.getElementById('app');
this.two = new Two({
      // width: 480, height: 800,
      fullscreen: true, // 全屏
}).appendTo(app);

Two.Path

two中所有对象都是Path的子类, 同时, 路径是不规则多边形的唯一表现形式.
如果没有贝塞尔曲线, 那么Path也是绘制曲线的唯一形式--通过描述尽可能多的点来绘制.

Two对象复用

制造Two对象是非常耗时的, 复用是一个不错的方法.

let c = two.makeCircle(60, 60, 10);
c.translation.x += 20;
two.update();

END

posted @ 2020-08-27 17:54  develon  阅读(271)  评论(0编辑  收藏  举报