Skip to content

Tween state object since v0.1

Follows the value of another state object, by tweening towards it.

If the state object is not animatable, the tween will just snap to the goal value.

    goal: StateObject<T>, 
    tweenInfo: CanBeState<TweenInfo>?
) -> Tween<T>


  • goal - The state object whose value should be followed.
  • tweenInfo - The style of tween to use when moving to the goal. Defaults to


since v0.1


Returns the current value stored in the state object.

If dependencies are being captured (e.g. inside a computed callback), this state object will also be added as a dependency.

(asDependency: boolean?) -> T


  • asDependency - If this is explicitly set to false, no dependencies will be captured.

Example Usage

local position = Value(UDim2.fromOffset(25, 50))
local smoothPosition = Spring(position, 25, 0.6)

local ui = New "Frame" {
    Parent = PlayerGui.ScreenGui,
    Position = smoothPosition

while true do
    -- apply an impulse
    smoothPosition:addVelocity(UDim2.fromOffset(-10, 10))
Back to top