cycleSeed

A random but stable number, 0..1, for each cycle index.

cycleSeed(index: Expr, salt: number = 0): Expr

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

The same index always gives the same value, so a meteor keeps its angle for the whole pass and picks a new one next time. Change salt for a second, independent draw.

Parameters

NameTypeNotes
indexExpr
saltnumberOptional. Default 0.

Example

const hue = motion.cycleSeed(index)
const size = motion.cycleSeed(index, 1)

See also

  • cycle — A repeating cycle as two numbers: progress (0..1 through the current cycle) and index (which cycle this is).