Skip to main content

TransitionModel

This model deduplicates and handles transitions for showing, hiding, and toggling. Inherits from BasicPane. See for more API.

Properties

SkipAnimationRequested

TransitionModel.SkipAnimationRequested: Signal<boolean>

Fires when TransitionModel.SetVisible is asked for the visibility the model already has, with doNotAnimate set.

BasicPane.VisibleChanged deliberately stays quiet there -- the visibility did not change. But doNotAnimate is a command ("be there now"), not state, and a transition may still be in-flight, so there is real work left to do. The model restarts its own transition in response; subclasses listen here to snap anything else they animate alongside it, rather than each overriding TransitionModel.SetVisible.

Functions

new

TransitionModel.new() → TransitionModel

A transition model that takes a set amount of time to show and hide. Can be used just like a BasicPane (in fact, it inherits from it), but additionally allows for variable length show and hide calls.

isTransitionModel

TransitionModel.isTransitionModel(valueany) → boolean

Returnes true if it's a transition model

SetVisible

TransitionModel.SetVisible(
isVisibleboolean,--

Whether or not the model should be visible

doNotAnimateboolean?--

True if this visiblity should not animate

) → ()

Sets the transition model to be visible.

Unlike BasicPane.SetVisible, asking for the visibility the model already has with doNotAnimate is not a no-op. The boolean has not changed, but a transition may still be running and the caller wants it finished now, so this fires TransitionModel.SkipAnimationRequested instead of dropping the call.

PromiseShow

TransitionModel.PromiseShow(
doNotAnimateboolean?
) → Promise

Shows the model and promises when the showing is complete.

PromiseHide

TransitionModel.PromiseHide(
doNotAnimateboolean?
) → Promise

Hides the model and promises when the showing is complete.

PromiseToggle

TransitionModel.PromiseToggle(
doNotAnimateboolean?
) → Promise

Toggles the model and promises when the transition is complete.

IsShowingComplete

TransitionModel.IsShowingComplete(selfTransitionModel) → boolean?

Returns true if showing is complete

IsHidingComplete

TransitionModel.IsHidingComplete(selfTransitionModel) → boolean?

Returns true if hiding is complete

ObserveIsShowingComplete

TransitionModel.ObserveIsShowingComplete(selfTransitionModel) → Observable<boolean>

Observe is showing is complete

ObserveIsHidingComplete

TransitionModel.ObserveIsHidingComplete(selfTransitionModel) → Observable<boolean>

Observe is hiding is complete

BindToPaneVisbility

TransitionModel.BindToPaneVisbility() → function--

Cleanup function

Binds the transition model to the actual visiblity of the pane

SetPromiseShow

TransitionModel.SetPromiseShow(
showCallbackfunction?--

Callback which should return a promise

) → ()

Sets the callback which will handle showing the transition

SetPromiseHide

TransitionModel.SetPromiseHide(
hideCallbackfunction?--

Callback which should return a promise

) → ()

Sets the callback which will handle hiding the transition

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "A transition model that takes a set amount of time to show\nand hide. Can be used just like a [BasicPane] (in fact, it\ninherits from it), but additionally allows for variable length\nshow and hide calls.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TransitionModel"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 49,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "isTransitionModel",
            "desc": "Returnes true if it's a transition model",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 100,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "SetVisible",
            "desc": "Sets the transition model to be visible.\n\nUnlike [BasicPane.SetVisible], asking for the visibility the model already has with\n`doNotAnimate` is not a no-op. The boolean has not changed, but a transition may still be\nrunning and the caller wants it finished now, so this fires\n[TransitionModel.SkipAnimationRequested] instead of dropping the call.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "isVisible",
                    "desc": "Whether or not the model 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": 115,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "PromiseShow",
            "desc": "Shows the model and promises when the showing is complete.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "doNotAnimate",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 132,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "PromiseHide",
            "desc": "Hides the model and promises when the showing is complete.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "doNotAnimate",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 146,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "PromiseToggle",
            "desc": "Toggles the model and promises when the transition is complete.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "doNotAnimate",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 160,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "IsShowingComplete",
            "desc": "Returns true if showing is complete",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 172,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "IsHidingComplete",
            "desc": "Returns true if hiding is complete",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 180,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "ObserveIsShowingComplete",
            "desc": "Observe is showing is complete",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 188,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "ObserveIsHidingComplete",
            "desc": "Observe is hiding is complete",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 196,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "BindToPaneVisbility",
            "desc": "Binds the transition model to the actual visiblity of the pane",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "pane",
                    "desc": "",
                    "lua_type": "BasicPane"
                }
            ],
            "returns": [
                {
                    "desc": "Cleanup function",
                    "lua_type": "function"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 206,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "SetPromiseShow",
            "desc": "Sets the callback which will handle showing the transition",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "showCallback",
                    "desc": "Callback which should return a promise",
                    "lua_type": "function?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 237,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "SetPromiseHide",
            "desc": "Sets the callback which will handle hiding the transition",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "hideCallback",
                    "desc": "Callback which should return a promise",
                    "lua_type": "function?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 248,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        },
        {
            "name": "_restartTransition",
            "desc": "Re-runs the transition for the visibility the model already has.\n\nTransitions normally start off [BasicPane.VisibleChanged], which only fires when the\nboolean changes. Subclasses call this when something their show or hide callback reads\nhas changed underneath it, so the callback runs again against the new state and the\ncompletion signals fire for the transition that actually happened.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TransitionModel"
                },
                {
                    "name": "doNotAnimate",
                    "desc": "True if the restarted transition should not animate",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 265,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "SkipAnimationRequested",
            "desc": "Fires when [TransitionModel.SetVisible] is asked for the visibility the model already\nhas, with doNotAnimate set.\n\n[BasicPane.VisibleChanged] deliberately stays quiet there -- the visibility did not\nchange. But doNotAnimate is a command (\"be there now\"), not state, and a transition may\nstill be in-flight, so there is real work left to do. The model restarts its own\ntransition in response; subclasses listen here to snap anything else they animate\nalongside it, rather than each overriding [TransitionModel.SetVisible].\n\n\t",
            "lua_type": "Signal<boolean>",
            "source": {
                "line": 71,
                "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
            }
        }
    ],
    "types": [],
    "name": "TransitionModel",
    "desc": "This model deduplicates and handles transitions for showing, hiding, and\ntoggling. Inherits from [BasicPane]. See for more API.",
    "source": {
        "line": 8,
        "path": "src/transitionmodel/src/Shared/TransitionModel.lua"
    }
}