oscillate
A smooth back-and-forth between min and max.
oscillate(
t: Expr,
opts: {rate?: number; min?: Expr | number; max?: Expr | number; offset?: number},
): Expr
Import motion from shaders/std and use motion.oscillate.
rate is cycles per second, default 1. min and max default to 0 and 1. offset shifts the starting point, in radians, so two oscillations can run out of step.
Parameters
| Name | Type | Notes |
|---|---|---|
t | Expr | |
opts | {rate?: number; min?: Expr | number; max?: Expr | number; offset?: number} |
Example
const breathe = motion.oscillate(animatedTime(params), {rate: 0.5, min: 0.6, max: 1})
See also
oscillating— A knob that sweeps betweenminandmaxon its own, for any slot that takes a prop.pulseTrain— An on/off rhythm: 1 for the first part of each cycle, 0 for the rest.phase— How far through a repeating cycle the clock is, 0..1.