Skip to content

Spring -> Spring<T>

function Fusion.Spring<T>(
    scope: Scope<unknown>,
    goal: UsedAs<T>,
    speed: UsedAs<number>?,
    damping: UsedAs<number>?
) -> Spring<T>

Constructs and returns a new spring state object.

Use scoped() method syntax

This function is intended to be accessed as a method on a scope:

local spring = scope:Spring(goal, speed, damping)


Parameters

scope : Scope<S>

The scope which should be used to store destruction tasks for this object.

goal : UsedAs<T>

The goal that this object should follow. For best results, the goal should be animatable.

speed : UsedAs<T>?

Multiplies how fast the motion should occur; doubling the speed exactly halves the time it takes for the motion to complete.

damping : UsedAs<T>?

The amount of resistance the motion encounters. 0 represents no resistance, 1 is just enough resistance to prevent overshoot (critical damping), and larger values damp out inertia effects and straighten the motion.


Returns -> Spring<T>

A freshly constructed spring state object.


Learn More

Back to top