Ciro Santilli OurBigBook.com $£ Sponsor €¥ 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
two-js/clone.js
#!/usr/bin/env node

const Two = require('two.js')

require('./common').render(
  __filename,
  (two) => {
    let n = 9;
    let dw = two.width/n;
    let line_width = dw*0.8;
    let dr = Math.PI/(n - 1);
    let line = new Two.Line(0, -line_width/2, 0, line_width/2);
    line.translation.set(-dw/2, two.height/2);
    line.rotation = -dr;
    for (let i = 0; i < n; i++) {
      // By passing two here we register the shape to the renderer.
      // https://github.com/jonobr1/two.js/issues/491
      line = line.clone(two);
      line.translation.addSelf(new Two.Vector(dw, 0));
      line.rotation += dr;
    }
  },
  400,
  100
);