Dumb question, but can we tween properties inside dictionaries?

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

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?

:bust_in_silhouette: Reply From: vinod

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.

Haha, this is great thank you!

wombatTurkey | 2016-08-19 02:29

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

SIsilicon | 2021-02-27 17:25