Jump to content

How tween circle or graphics?


rageofaxe
 Share

Recommended Posts

Snippet for phaser2:

    const graphics = game.add.graphics(x, y);
    graphics.height = 0;
    graphics.width = 0;
    alpha = 0.5;

    const bounce = game.add.tween(graphics);
    bounce.to({
      height: 300,
      width: 300,
      alpha: 0
    }, 300);

    bounce.start();

 Actually, is it possible for phaser3? This snippet not resize circle:

const circle = new Phaser.Geom.Circle(400, 300, 50);
const graphics = this.add.graphics();
graphics.fillStyle(0x00ff00);
graphics.fillCircleShape(circle);

this.tweens.add({
  targets: graphics,
  alpha:  {getStart: () => 0, getEnd: () => 1},
  height: 500,
  width: 500,
  // or radius
  duration: 1000,
});

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...