Are there any good examples of how and when to use Key and Object when tweening?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By indy2005

I use tween keys all the time in Construct 3. Can’t get my head round this in Godot

:bust_in_silhouette: Reply From: klaas

asume you have that script in an sprite2D

#create a tween
var tween =   
#dont forget to get it in the scene tree ... we do it as our child

tween.interpolate_property( self,   # ...we want this node
           "position",   # ... the position attribute 
		Vector2(0, 0),   # ... to tween from this position
            Vector2(100, 100),    # ... to that position
            1,  # ... in one second

tween.start() #lets go

Thanks … altough this example does not touch on the key attribute

indy2005 | 2020-09-17 13:30

it does what?

klaas | 2020-09-17 13:32

Exactly my question!!

indy2005 | 2020-09-17 15:29

Do you mean the object and key in … ?

remove ( Object object, String key="" )
reset ( Object object, String key="" )
resume ( Object object, String key="" )
stop ( Object object, String key="" )

those are the Object to tween and the NodePath of the property/method
in my example it would be

tween.stop ( self, "position" )

klaas | 2020-09-17 17:57

Thank you klaas!

This helped me.

AlwaysDan | 2021-01-10 23:03