rageofaxe

How tween circle or graphics?

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,
});

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.