cycle
A repeating cycle as two numbers: progress (0..1 through the current cycle) and index (which cycle this is).
cycle(t: Expr, period: Expr | number): {progress: Expr; index: Expr}
Import motion from shaders/std and use motion.cycle.
period is the cycle length in seconds. The "every N seconds" word: fade something in with progress, and feed index to cycleSeed when each pass should look different.
Parameters
| Name | Type | Notes |
|---|---|---|
t | Expr | |
period | Expr | number |
Example
const {progress, index} = motion.cycle(animatedTime(params), 2) // a new pass every 2 s
See also
cycleSeed— A random but stable number, 0..1, for each cycle index.phase— How far through a repeating cycle the clock is, 0..1.pulseTrain— An on/off rhythm: 1 for the first part of each cycle, 0 for the rest.