pulseTrain

An on/off rhythm: 1 for the first part of each cycle, 0 for the rest.

pulseTrain(
  t: Expr,
  opts: {period: Expr | number; duty: Expr | number; soften?: number},
): Expr

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

period is seconds per cycle and duty is the on fraction, 0..1. soften eases both edges over that fraction of the cycle. Leave it at 0 for a hard blink.

Parameters

NameTypeNotes
tExpr
opts{period: Expr | number; duty: Expr | number; soften?: number}

Example

const blink = motion.pulseTrain(animatedTime(params), {period: 1.5, duty: 0.3, soften: 0.05})

See also

  • pulsing — A knob that switches on and off in a rhythm, for any slot that takes a prop.
  • 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.