@revideo/core / flow / loopFor
Function: loopFor()
loopFor(
seconds,factory):ThreadGenerator
Defined in: flow/loopFor.ts:28
Run a generator in a loop for the given amount of time.
Parameters
seconds
number
The duration in seconds.
factory
A function creating the generator to run. Because generators can’t be reset, a new generator is created on each iteration.
Returns
Remarks
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.
Example
yield* loopFor(
3,
() => circle().position.x(-10, 0.1).to(10, 0.1)
);