正方形的圆旋转。 Phaser3

时间:2019-09-24 19:28:52

标签: javascript phaser-framework

以下代码将图片旋转一圈

function create() {
  followers = this.add.container();

  for (let i = 0; i < 3; i++) {
    let ball = followers.create(0, 0, 'ball').setScale(0.7);
    ball.setData('vector', new Phaser.Math.Vector2());

    lal = this.tweens.add({
      targets: ball,
      z: -1,
      ease: 'Linear',
      duration: 12370,
      repeat: -1,
      delay: i * 320
    });
  }
}

function update() {
  balls = followers.getChildren();

  for (let i = 0; i < balls.length; i++) {
    let t = balls[i].z;
    let vec = balls[i].getData('vector');

    curve.getPoint(t, vec);
    balls[i].setPosition(vec.x, vec.y);
    balls[i].setDepth(10);
  }

  followers.setDepth(10)
}

如何使无限个正方形旋转一圈?例如,使10个正方形旋转一圈与图片一样

0 个答案:

没有答案