Skip to main content

flow

import {...} from "@revideo/core/lib/flow";

Utilities for controlling the flow and timing of an animation.

Interfaces

Functions

all

Run all tasks concurrently and wait for all of them to finish.

Examples

Parameters


any

Run all tasks concurrently and wait for any of them to finish.

Examples

Parameters


chain

public chain...tasks: CallbackThreadGenerator[]: ThreadGenerator

Run tasks one after another.

Examples

Parameters


delay

public delaytime: numbertask: CallbackThreadGenerator: ThreadGenerator

Run the given generator or callback after a specific amount of time.

Examples

Parameters


every

Call the given callback every N seconds.

Examples

Parameters


loop

Run the given generator in a loop.

Each iteration waits until the previous one is completed. Because this loop never finishes it cannot be used in the main thread. Instead, use yield or spawn to run the loop concurrently.

Examples

Parameters

  • factory: LoopCallback

    A function creating the generator to run. Because generators can't be reset, a new generator is created on each iteration.


loopFor

Run a generator in a loop for the given amount of time.

Generators are executed completely before the next iteration starts. An iteration is allowed to finish even when the time is up. This means that the actual duration of the loop may be longer than the given duration.

Examples

Parameters

  • seconds: number

    The duration in seconds.

  • factory: LoopCallback

    A function creating the generator to run. Because generators can't be reset, a new generator is created on each iteration.


loopUntil

public loopUntilevent: stringfactory: LoopCallback: ThreadGenerator

Run a generator in a loop until the given time event.

Generators are executed completely before the next iteration starts. An iteration is allowed to finish even when the time is up. This means that the actual duration of the loop may be longer than the given duration.

Examples

Parameters

  • event: string

    The event.

  • factory: LoopCallback

    A function creating the generator to run. Because generators can't be reset, a new generator is created on each iteration.


noop

public noop(): ThreadGenerator

Do nothing.


run

Turn the given generator function into a task.

If you want to immediately run the generator in its own thread, you can use spawn instead. This function is useful when you want to pass the created task to other flow functions.

Examples

Parameters


sequence

public sequencedelay: number...tasks: ThreadGenerator[]: ThreadGenerator

Start all tasks one after another with a constant delay between.

The function doesn't wait until the previous task in the sequence has finished. Once the delay has passed, the next task will start even if the previous is still running.

Examples

Parameters


waitFor

public waitForseconds: number = 0after?: ThreadGenerator: ThreadGenerator

Wait for the given amount of time.

Examples

Parameters


waitUntil

public waitUntilevent: stringafter?: ThreadGenerator: ThreadGenerator

Wait until the given time event.

Time events are displayed on the timeline and can be edited to adjust the delay. By default, an event happens immediately - without any delay.

Examples

Parameters