See all glossary terms

Tween

A tween (short for in-betweening) is code that smoothly animates changes in properties over time. For example, you can use a tween animation to move a character across the screen, fade an object in or out, or make an item float up and down.
Notice how every item moves at a slightly different pace in this animation, making the animation natural. Because tweens use code, we can easily change the speed and timing of the animation on the fly. You can also use tweens to animate things dynamically, taking the current state of the game into account.
Godot makes it easy to use tweens with its built-in tween system. You can set up a tween by calling the create_tween() function from a node, then calling functions on the returned object and specifying the object you want to animate, the property you want to change, the target value, and how long it should take.
You can have multiple tweens running simultaneously or chain tweens together to create multi-step animations. You can also use different easing functions to control the speed and smoothness of the animation. For example, you can use an easing function to make an object start moving slowly, speed up, and slow down again as it reaches its target.
In summary, tweens are a powerful tool for creating smooth, dynamic animations in your games!