Skip to content

1681-engine / index / transitionTo

Function: transitionTo() ​

ts
function transitionTo(
   engine, 
   next, 
   transition, 
   mode?
): Promise<void>;

Defined in: src/transitions/transitionTo.ts:21

Changes scene behind a transition: covers the screen, runs engine.scenes.replace(next) (or push, or pop, for which next is ignored) — waiting out an async onEnter while covered — then reveals. Resolves when the reveal ends. The overlay is removed and the transition disposed even when the scene change throws, which is re-thrown.

ts
await transitionTo(engine, new Level2(), new FadeTransition({ duration: 250 }));

Parameters ​

ParameterTypeDefault value
engineEngineundefined
nextScene | nullundefined
transitionTransitionundefined
modeTransitionMode'replace'

Returns ​

Promise<void>

Released under the MIT License.