+2 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?

in Engine by (72 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

+4 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).

by (21,800 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.