phase

How far through a repeating cycle the clock is, 0..1.

phase(t: Expr, period: Expr | number): Expr

Import motion from shaders/std and use motion.phase.

period is the cycle length in seconds. The value ramps from 0 to 1 and snaps back.

Parameters

NameTypeNotes
tExpr
periodExpr | number

Example

const sweep = motion.phase(animatedTime(params), params.uniforms.period)

See also

  • cycle — A repeating cycle as two numbers: progress (0..1 through the current cycle) and index (which cycle this is).
  • oscillate — A smooth back-and-forth between min and max.