How to change sprite alpha

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By leg0
:warning: Old Version Published before Godot 3 was released.

Hey, new here :slight_smile:

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)
t.start()

yield(t, "tween_complete")

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

Thanks !

:bust_in_silhouette: Reply From: leg0

I got it to work !

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

	tween = Tween.new()
	contextNode.add_child(tween)

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,

eons | 2017-02-04 00:01

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.

leg0 | 2017-02-11 13:08