0 votes

Hello. I am doing a 2d light glowing animation. I use AnimationPlayer node for this task, by scaling the light texture from 0.5 to 1.0, and back to 0.5. (repeat loop)

However, I would like to make the light glowing more naturally by changing the scaling to a random value, instead of scaling in between a fix value of 0.5 and 1.0.

May I know if AnimationPlayer node is possible to allocate a random value in it's key frame after every loop of animation?

asked May 13 in Engine by pengyou (42 points)

As the answer suggests, you want to Tween your light and not animate it, as tweening is better for both performance and runtime animation generating, like what you want...

Tweening is generally better for anything that isnt complex(like a up down scaling button) since a Tween node can do multiple animations at once and AnimationPlayer can play only one

Thanks! Since you mentioned that tweening is better in performance, does it means that it is always better to use tweening instead of AnimationPlayer if the situation allow?

1 Answer

+3 votes

Instead of an AnimationPlayer, why not do this with a Tween instead? Both are similar for this type of "simple" animation, but the Tween is easier to adjust via code (IMO).

answered May 13 by jgodfrey (5,540 points)

Thanks! I will try it out tonight about Tween in Godot

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.