How to Tween a dictionary value

Godot Version

Godot 4.2

Question

If i have a dictionary like so:

dict = {a : 1, b : 2, c : 3}

how can I tween the value a from 1 to 100?

You may need to @export that dictionary in order to use it in the animation tab.

I mean a tween like this Tween — Godot Engine (stable) documentation in English

Yea, I haven’t used it much. But have you tried the interpolate_value( dic, {a:100, b:dic.b, c:dic.c}, ...)?

That seems very comberson to work with dictionaries and may not work.

Maybe just using it directly interpolate_value( dic.a, 100, ...)?

Maybe references will work will work in this manor?

Have you tried these?

var tween := create_tween()
tween.tween_property(self, "dict:a", 100, 4.0)
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.