flashes
Short, bright flashes at a steady rate: dark most of the time, peaking briefly to 1.
flashes(
t: Expr,
opts: {rate: Expr | number; offset?: Expr | number; sharpness: 2 | 4 | 8 | 16},
): Expr
Import motion from shaders/std and use motion.flashes.
rate is how fast it runs (radians per second of the clock, so about 1 is one flash every six seconds). offset shifts when the flashes land, in radians; give each element its own (a hash times 2π) so they don't flash together. sharpness sets how brief each flash is: 2, 4, 8 or 16, where larger is briefer.
Parameters
| Name | Type | Notes |
|---|---|---|
t | Expr | |
opts | {rate: Expr | number; offset?: Expr | number; sharpness: 2 | 4 | 8 | 16} |
Example
const blink = motion.flashes(animatedTime(params), {rate: 1.4, offset: mul(seed, 6.283), sharpness: 8})
See also
pulseTrain— An on/off rhythm: 1 for the first part of each cycle, 0 for the rest.oscillate— A smooth back-and-forth betweenminandmax.