Extends Easing

Easing.Spring

easing: Easing.Spring {}

Easing.Spring is a dynamic easing curve. Animations using a spring are not subject to the fixed duration set on the animation. Instead, the animation is physically simulated and will take a different amount of time depending on the spring parameters and the range of the animating value. This makes animations appear more physically realistic.

property Float tension: 200

property Float friction: 10

The tension and friction parameters control the spring's behavior.

Tension describes how "strong" the spring is at pulling the value towards its destination. Higher tension values result in the spring exerting more force, animating faster and bouncing more.

The friction controls the force opposing the spring's pull, which determines how quickly the animation settles down and stops oscillating. Because it acts to inhibit the spring, friction is often called the "damping" value. A sufficiently high friction will prevent any bouncing at all, which is called an overdamped spring.

property Float mass: 1

The mass property controls the virtual "mass" being moved by the spring. This is essentially a scaling factor for the tension and friction properties. For example, setting a mass of 2 has the same result as halving the tension and friction properties. Similarly, a mass of 0.5 has the effect of doubling the tension and friction values.