Jump to content

Tweening a Variable


ottohak
 Share

Recommended Posts

Hi guys,

 

Currently I draw a Circle(Graptics) on the Screen with Graphics.DrawCircle. And I would love to scale the circle with a tween Effect. Because the third parameter of drawCircle is asking for a radius I would love to change the value of the radius with a tween.

 

Thats what I tried:

var outerCircleRadius = 50.0;in create:outerCircleTween = game.add.tween(outerCircleRadius);outerCircleTween.to(50, 100, Phaser.Easing.Linear.None);outerCircleTween.start();in update:outerCircleGraphics.clear();outerCircleGraphics.drawCircle(400, 450, outerCircleRadius);outerCircleGraphics.endFill();

But outerCircleRadius stays at 50.

 

Thanks

 

Link to comment
Share on other sites

Personally I recommend using properties for this, so you can do more than just change value of variable. My personal approach is "timeline" tween from 0 to 1 and then using it as reference how to modify composition of values. You get away with one tween and can do work of many tweens in properly synced style.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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