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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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