0 votes

Hi everyone,

I wanna interpolate the opacity of an AnimatedSprite using a Tween node in Godot 3.0, but there's no opacity property in the inspector, since I tried

"visibility/opacity"

which worked fine in 2.1, but has no effect here.
Does that mean they haven't implemented it yet or am I using the wrong property string?

asked Oct 13, 2017 in Engine by DodoIta (471 points)

1 Answer

+3 votes
Best answer

In 3.0, the property is modulate, which combines color and transparency.

To tween the property, since the value is a Color, you have to give two colors as an argument. So to just fade the sprite you'd do this:

$Tween.interpolate_property($AnimatedSprite, "modulate", 
    Color(1, 1, 1, 1), Color(1, 1, 1, 0), 2.0, 
    Tween.TRANS_LINEAR, Tween.EASE_IN)
answered Oct 13, 2017 by kidscancode (17,770 points)
selected Oct 14, 2017 by DodoIta

Thanks, it works!
I actually got there, but I kept using Color(255, 255, 255, 0) because I got confused with CSS :p
BTW I love your videos, keep up the good work!

`

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.