hashPhase

A random but stable angle in radians, 0..2π, from a seed.

hashPhase(seed: Val, salt: {k: number; big: number}): Expr

Import math from shaders/std and use math.hashPhase.

Use it to start each of several sine motions at a different point so they do not move in step. salt is a pair of constants. Give each independent phase its own pair.

Parameters

NameTypeNotes
seedVal
salt{k: number; big: number}

Example

const wobble = sin(add(mul(t, 0.7), hashPhase(params.uniforms.seed, {k: 53.7, big: 3847.2})))

See also

  • sin — The sine of an angle in radians, −1..1.

Used by

Aurora