Skip to main content

TimedTween

Tween that is a specific time, useful for countdowns and other things

Functions​

new​

TimedTween.new(
transitionTime: ValueObject.Mountable<number>?--

Optional transition time

) → TimedTween

Timed transition module

SetVisible​

TimedTween.SetVisible(
self: TimedTween,
isVisible: boolean,--

Whether or not the tween should be visible

doNotAnimate: boolean?--

True if this visiblity should not animate

) → ()

Sets the tween to be visible.

Unlike BasicPane.SetVisible, re-setting the visibility the tween already has with doNotAnimate is not a no-op: the boolean has not changed, but the tween may still be running, and doNotAnimate means the caller wants it finished now.

SetTransitionTime​

TimedTween.SetTransitionTime(
self: TimedTween,
transitionTime: ValueObject.Mountable<number>
) → () → ()

Sets the transition time

GetTransitionTime​

TimedTween.GetTransitionTime(self: TimedTween) → number

Gets the transition time

SetClock​

TimedTween.SetClock(
self: TimedTween,
clock: () → number
) → ()

Sets the clock the tween reads time from. Defaults to os.clock.

Safe to call mid-tween. The stored times are shifted onto the new clock's timebase, so the current position, the transition duration, and the time left all carry over exactly -- the animation neither jumps nor restarts.

GetClock​

TimedTween.GetClock(self: TimedTween) → () → number

Gets the clock the tween reads time from.

ObserveTransitionTime​

TimedTween.ObserveTransitionTime(self: TimedTween) → Observable<number>

Observes the transition time

ObserveRenderStepped​

TimedTween.ObserveRenderStepped(self: TimedTween) → Observable<number>

Observes how far into the transition we are, from 0 to 1

ObserveOnSignal​

TimedTween.ObserveOnSignal(
self: TimedTween,
signal: Signal
) → Observable<number>

Observes the transition on a specific signal

Observe​

TimedTween.Observe(self: TimedTween) → Observable<number>

Observes the transition

PromiseFinished​

TimedTween.PromiseFinished(self: TimedTween) → Promise

Promises when the tween is finished

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Timed transition module",
            "params": [
                {
                    "name": "transitionTime",
                    "desc": "Optional transition time",
                    "lua_type": "ValueObject.Mountable<number>?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 59,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "SetVisible",
            "desc": "Sets the tween to be visible.\n\nUnlike [BasicPane.SetVisible], re-setting the visibility the tween already has with\n`doNotAnimate` is not a no-op: the boolean has not changed, but the tween may still be\nrunning, and `doNotAnimate` means the caller wants it finished now.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                },
                {
                    "name": "isVisible",
                    "desc": "Whether or not the tween should be visible",
                    "lua_type": "boolean"
                },
                {
                    "name": "doNotAnimate",
                    "desc": "True if this visiblity should not animate",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 97,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "SetTransitionTime",
            "desc": "Sets the transition time",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                },
                {
                    "name": "transitionTime",
                    "desc": "",
                    "lua_type": "ValueObject.Mountable<number>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 117,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "GetTransitionTime",
            "desc": "Gets the transition time",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 126,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "SetClock",
            "desc": "Sets the clock the tween reads time from. Defaults to `os.clock`.\n\nSafe to call mid-tween. The stored times are shifted onto the new clock's timebase, so the\ncurrent position, the transition duration, and the time left all carry over exactly -- the\nanimation neither jumps nor restarts.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                },
                {
                    "name": "clock",
                    "desc": "",
                    "lua_type": "() -> number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 139,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "GetClock",
            "desc": "Gets the clock the tween reads time from.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 160,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "ObserveTransitionTime",
            "desc": "Observes the transition time",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 169,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "ObserveRenderStepped",
            "desc": "Observes how far into the transition we are, from 0 to 1",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 178,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "ObserveOnSignal",
            "desc": "Observes the transition on a specific signal",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                },
                {
                    "name": "signal",
                    "desc": "",
                    "lua_type": "Signal"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 188,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "Observe",
            "desc": "Observes the transition",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 211,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "PromiseFinished",
            "desc": "Promises when the tween is finished",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 220,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        },
        {
            "name": "_scheduleFinish",
            "desc": "Schedules resolving a finish promise, returning a task that cancels the schedule.\n\n`task.delay` counts wall time, which only tracks the tween while the clock is the real one.\nUnder an injected clock the time left is in that clock's units and may not advance with wall\ntime at all, so poll that clock each frame instead. The default clock keeps the cheap path.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TimedTween"
                },
                {
                    "name": "rtime",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "promise",
                    "desc": "",
                    "lua_type": "Promise.Promise<()>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any\n"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 261,
                "path": "src/timedtween/src/Shared/TimedTween.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "TimedTween",
    "desc": "Tween that is a specific time, useful for countdowns and other things",
    "source": {
        "line": 7,
        "path": "src/timedtween/src/Shared/TimedTween.lua"
    }
}