0 votes

Example, (works):

var turkey = 100
Tweener.interpolate_property(self, "turkey", 100, 1, 5, 1, 1)

Example, (doesn't work):

 var turkey = { rofl = 100 }
Tweener.interpolate_property(self, "turkey.rofl", 100, 1, 5, 1, 1)

Is it possible to get tweening to work on dictionary properties too?

in Engine by (308 points)

1 Answer

+1 vote
Best answer

The first parameter of the method is target object and the second parameter is the target property. So you need to pass the first parameter as the dictionary and the second one as the property key inside the dictionary.

Tweener.interpolate_property(turkey, "rofl", 100, 1, 5, 1, 1)

There is also another neat trick to tween almost anything by creating a tween from 0 to 1 and inside it's update you can lerp between the real values by taking the passed value.

by (750 points)
selected by

Haha, this is great thank you!

This doesn't seem to work in Godot 3.2, since Dictionaries aren't Objects. :(

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.