0 votes

Hey, new here :)

I'm trying to tween the alpha of a sprite (or anything compatible with alpha)

I found some topics about tweening but none about how to simply change the alpha of an object.

Any clues ?

What I got so far ...

var t = Tween.new()
t.interpolate_property(aLabel,"visibility/opacity",1, 0, 1,Tween.TRANS_LINEAR, Tween.EASE_OUT)

yield(t, "tween_complete")

But the object opacity is not changing and this don't get the yield complete signal

Thanks !

in Engine by (31 points)
edited by

1 Answer

+1 vote

I got it to work !

A tween NEED to be added as child of a node to update

    tween = Tween.new()
by (31 points)

If the tween will be always there, you can add it to the scene tree with the editor and use it to tween all the properties you want,

Another thing that took me time to find out of needed :
To know what to type for the "String method" param you can go in the editor and hover with the mouse over a property label. This will make a tooltip appear. WIthin that tooltip you can see the property path to type.

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.
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 webmaster@godotengine.org with your username.