[Go to site: main page, start]

Class TransitionContainer

Persistent overlay dedicated to scene transitions.

Hierarchy (View Summary)

Index

Properties

defaultDuration: number = 1000

Default transition duration used by TransitionContainer#_play when no explicit duration is provided (milliseconds).

defaultTransitionType: string = CONFIG.Canvas.sceneTransitions.fade.id

Desired transition type to use for transitions when no explicit type is provided.

isLocked: boolean = false

Flag indicating whether this container is reserved for an external workflow. When true, core scene transitions should not use this container.

Accessors

  • get isRunning(): boolean

    Flag indicating whether a transition animation is currently running. Prevents overlapping calls to TransitionContainer#_play.

    Returns boolean

  • get promise(): Promise<void> | null

    Promise that resolves when the current transition finishes or is cancelled. Reused to return the same promise on repeated TransitionContainer#_play calls.

    Returns Promise<void> | null

Methods

  • Internal

    Capture the currently displayed scene into a render texture and show it. If black is true, uses a solid black frame instead of capturing the scene.

    Parameters

    • Optionaloptions: { black?: boolean; clearColor?: number[] } = {}

      Capture options.

      • Optionalblack?: boolean

        When true, uses a black frame instead of capturing.

      • OptionalclearColor?: number[]

        RGBA clear color in the 0-1 range.

    Returns RenderTexture | null

    The render texture of the current scene, or null if black.

  • Internal

    Capture the next rendered frame of the new scene into a render texture. Internally waits for the next postrender so all canvas groups and caches are fully updated before capturing. The filter class and filter type are resolved from CONFIG.Canvas.sceneTransitions.

    Parameters

    • Optionaloptions: { clearColor?: number[]; transitionType?: string } = {}

      Capture options.

    Returns Promise<RenderTexture>

    Promise resolving to the captured render texture.

  • Run the transition animation from the captured "from" texture to the "to" texture. If a transition is already running, returns the existing promise. If no filter has been prepared, resolves immediately.

    Parameters

    • Optionalopts: { duration?: number; easing?: Function } = {}

      Animation options.

      • Optionalduration?: number

        Duration in milliseconds.

      • Optionaleasing?: Function

        Easing function mapping [0,1] to [0,1].

    Returns Promise<void>

    Promise that resolves when the transition completes.

  • Reset the internal state of the transition container.

    Returns void

  • Cancel any currently running transition and await its termination.

    Returns Promise<void>

  • Run a full transition around a given canvas operation. Encapsulates captureCurrentScene => operation/scene switch => captureNextScene => play.

    If both options.operation and options.nextScene are provided, the operation runs first, then the Scene is switched.

    If neither options.operation nor options.nextScene are provided, a simple demo transition is performed from a black frame to the currently rendered Scene.

    Parameters

    • Optionaloperation: Function = {}

      Async function performing canvas changes.

    Returns Promise<void>

    Promise that resolves when the transition completes.

    await canvas.transition.run({
    operation: async () => {
    await canvas.animatePan({
    x: 2000,
    y: 1500,
    scale: 1.25,
    duration: 0
    });
    },
    duration: 800,
    transitionType: "dots"
    });
    const scene = game.scenes.get("ABC123");
    await canvas.transition.run({
    nextScene: scene,
    activate: true,
    duration: 1200,
    transitionType: "fade"
    });
    await canvas.transition.run({
    fromBlack: true,
    duration: 800,
    transitionType: "swirl"
    });