Animate alpha of gui nodes (SOLVED)

Hey I hope that everyone is well,

I was wondering the best practices for animating the color.w of a note (so it fades in and out) and still leaving the colours as they are. Since I am using vector 4, what should I put in the RGB spots so that the original colour is retained?

If you need more info please let me know.

All the best,
V

Keep the RGB (x,y,z) values the same and just animate the alpha channel (w). For example:

vmath.vector4(1, 0.5, 0.25, 1) -> vmath.vector4(1, 0.5, 0.25, 0)

If I remember correctly, you can

gui.animate(node, "color.w", value, easing, duration)
2 Likes

hi

To leave colours the same I suggest to use this code

gui.animate(node, 'color.w', 0, gui.EASING_LINEAR, 1, 0, nil, gui.PLAYBACK_LOOP_PINGPONG)

5 Likes

Thanks, this worked great!

Hello!