Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | vickz |
Hello ,
I would like to reduce my sprite scale from 1 to 0 in 5 second time.
I have try with timer but without good result.
Thanks
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | vickz |
Hello ,
I would like to reduce my sprite scale from 1 to 0 in 5 second time.
I have try with timer but without good result.
Thanks
Reply From: | jgodfrey |
The most obvious ways to do it would be either with a Tween
or an AnimationPlayer
.
As an example, to use AnimationPlayer
…
AnimationPlayer
node to your scenescaleAnim
in the below code)To play the animation from code, just call the following from a script attached to the parent of the scene
$AnimationPlayer.play("scaleAnim")
To do it with a Tween
would go something like this:
Tween
node to your scene. $Tween.interpolate_property($Sprite, "scale", 1, 0, 5, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
$Tween.start();
thanks , look pretty obvious
my current solution was to us lerp_range to remap timer value to 0-1
vickz | 2020-04-25 14:42