Skip to main content

SpringObject

This is like a Spring, but it can be observed, and emits events. It handles Observables and

Properties​

Changed​

SpringObject.Changed: Signal<()>--Fireswheneverthespringinitiallychangesstate

Event fires when the spring value changes

Functions​

new​

SpringObject.new(
target: T,
speed: number | Observable<number> | ValueObject<number> | NumberValue | any,
damper: number | Observable<number> | NumberValue | any
) → Spring<T>

Constructs a new SpringObject.

The spring object is initially initialized as a spring at 0, with a target of 0. Upon setting a target or position, it will be initialized and begin emitting events.

If two observables emit different types the spring will retain the speed, damper, and switch to an initializes.

isSpringObject​

SpringObject.isSpringObject(value: any) → boolean

Returns whether an object is a SpringObject.

ObserveRenderStepped​

SpringObject:ObserveRenderStepped() → Observable<T>

Observes the spring animating

Observe​

SpringObject:Observe() → Observable<T>

ObserveTarget​

SpringObject:ObserveTarget() → Observable<T>

Observes the current target of the spring

PromiseFinished​

SpringObject:PromiseFinished(signal: RBXScriptSignal | nil) → Observable<T>

Promises that the spring is done, based upon the animating property. Relatively expensive.

ObserveOnSignal​

SpringObject:ObserveOnSignal(signal: RBXScriptSignal) → Observable<T>

Observes the spring animating

IsAnimating​

SpringObject:IsAnimating() → boolean--

True if animating

Returns true when we're animating

Impulse​

SpringObject:Impulse(
velocity: T--

The velocity to impulse with

) → ()

Impulses the spring, increasing velocity by the amount given. This is useful to make something shake, like a Mac password box failing.

SetTarget​

SpringObject:SetTarget(
target: T,--

The target to set

doNotAnimate: boolean?--

Whether or not to animate

) → ()

Sets the actual target. If doNotAnimate is set, then animation will be skipped.

SetVelocity​

SpringObject:SetVelocity(velocity: T) → ()

Sets the velocity for the spring

SetPosition​

SpringObject:SetPosition(position: T) → ()

Sets the position for the spring

SetDamper​

SpringObject:SetDamper(damper: number | Observable<number>) → ()

Sets the damper for the spring

SetSpeed​

SpringObject:SetSpeed(speed: number | Observable<number>) → ()

Sets the speed for the spring

SetClock​

SpringObject:SetClock(clock: () → (number)) → ()

Sets the clock function for the spring

SetEpsilon​

SpringObject:SetEpsilon(epsilon: number) → ()

Sets the epsilon for the spring to stop animating

TimeSkip​

SpringObject:TimeSkip(
delta: number--

Time to skip forwards

) → ()

Instantly skips the spring forwards by that amount time

Destroy​

SpringObject:Destroy() → ()

Cleans up the BaseObject and sets the metatable to nil

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new SpringObject.\n\nThe spring object is initially initialized as a spring at 0, with a target of 0. Upon setting\na target or position, it will be initialized and begin emitting events.\n\nIf two observables emit different types the spring will retain the speed, damper, and switch to\nan initializes.",
            "params": [
                {
                    "name": "target",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "speed",
                    "desc": "",
                    "lua_type": "number | Observable<number> | ValueObject<number> | NumberValue | any"
                },
                {
                    "name": "damper",
                    "desc": "",
                    "lua_type": "number | Observable<number> | NumberValue | any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Spring<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 85,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "isSpringObject",
            "desc": "Returns whether an object is a SpringObject.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 122,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "ObserveRenderStepped",
            "desc": "Observes the spring animating",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 130,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "Observe",
            "desc": "Alias for [SpringObject:ObserveRenderStepped]",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 139,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "ObserveTarget",
            "desc": "Observes the current target of the spring",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 148,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "PromiseFinished",
            "desc": "Promises that the spring is done, based upon the animating property.\nRelatively expensive.",
            "params": [
                {
                    "name": "signal",
                    "desc": "",
                    "lua_type": "RBXScriptSignal | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 179,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "ObserveOnSignal",
            "desc": "Observes the spring animating",
            "params": [
                {
                    "name": "signal",
                    "desc": "",
                    "lua_type": "RBXScriptSignal"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 250,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "IsAnimating",
            "desc": "Returns true when we're animating",
            "params": [],
            "returns": [
                {
                    "desc": "True if animating",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 277,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "Impulse",
            "desc": "Impulses the spring, increasing velocity by the amount given. This is useful to make something shake,\nlike a Mac password box failing.",
            "params": [
                {
                    "name": "velocity",
                    "desc": "The velocity to impulse with",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "()"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 293,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetTarget",
            "desc": "Sets the actual target. If doNotAnimate is set, then animation will be skipped.",
            "params": [
                {
                    "name": "target",
                    "desc": "The target to set",
                    "lua_type": "T"
                },
                {
                    "name": "doNotAnimate",
                    "desc": "Whether or not to animate",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 306,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetVelocity",
            "desc": "Sets the velocity for the spring",
            "params": [
                {
                    "name": "velocity",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 354,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetPosition",
            "desc": "Sets the position for the spring",
            "params": [
                {
                    "name": "position",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 380,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetDamper",
            "desc": "Sets the damper for the spring",
            "params": [
                {
                    "name": "damper",
                    "desc": "",
                    "lua_type": "number | Observable<number>"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 405,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetSpeed",
            "desc": "Sets the speed for the spring",
            "params": [
                {
                    "name": "speed",
                    "desc": "",
                    "lua_type": "number | Observable<number>"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 438,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetClock",
            "desc": "Sets the clock function for the spring",
            "params": [
                {
                    "name": "clock",
                    "desc": "",
                    "lua_type": "() -> (number)"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 471,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "SetEpsilon",
            "desc": "Sets the epsilon for the spring to stop animating",
            "params": [
                {
                    "name": "epsilon",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 489,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "TimeSkip",
            "desc": "Instantly skips the spring forwards by that amount time",
            "params": [
                {
                    "name": "delta",
                    "desc": "Time to skip forwards",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "()"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 502,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the BaseObject and sets the metatable to nil",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 658,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Changed",
            "desc": "Event fires when the spring value changes",
            "lua_type": "Signal<()> -- Fires whenever the spring initially changes state",
            "source": {
                "line": 97,
                "path": "src/blend/src/Shared/Blend/SpringObject.lua"
            }
        }
    ],
    "types": [],
    "name": "SpringObject",
    "desc": "This is like a [Spring], but it can be observed, and emits events. It handles [Observable]s and",
    "source": {
        "line": 7,
        "path": "src/blend/src/Shared/Blend/SpringObject.lua"
    }
}