Skip to Content

@revideo/core


@revideo/core / flow / delay

Function: delay()

delay(time, task): ThreadGenerator

Defined in: flow/delay.ts:32 

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

Parameters

time

number

The delay in seconds

task

Callback | ThreadGenerator

The task or callback to run after the delay.

Returns

ThreadGenerator

Example

yield* delay(1, rect.fill('#ff0000', 2));

Note that the same animation can be written as:

yield* waitFor(1), yield* rect.fill('#ff0000', 2),

The reason delay exists is to make it easier to pass it to other flow functions. For example:

yield* all( rect.opacity(1, 3), delay(1, rect.fill('#ff0000', 2)); );
© 2026 Haven Technologies, Inc.
Function: delay() – Revideo