scatterField

A mesh-gradient field: up to 8 drifting points scattered across the canvas, blended by nearness.

scatterField(opts: {
    at: Expr
    count: Expr | number
    seed: Expr | number
    drift: Expr | number
    aspect: Expr | number
    time: Expr | number
    softness: Expr | number
    /** The points precomputed each frame by `scatteredAnchors`. When given, `drift`, `aspect` and `time` are ignored here. */
    anchors?: Expr
}): Expr

Import paint from shaders/std and use paint.scatterField.

Each point carries a fixed 0–1 value and the result is their distance-weighted average, so a palette lookup gives soft patches of color. at is an aspect-corrected coordinate (x runs 0 to the aspect ratio, y 0–1). count is 1–8, seed reshuffles the layout, drift (0–1) sets how far points wander on time, softness sharpens the patches as it rises. Pass anchors from scatteredAnchors to skip recomputing the points per pixel.

Parameters

NameTypeNotes
opts`{
at: Expr
count: Expr \| number
seed: Expr \| number
drift: Expr \| number
aspect: Expr \| number
time: Expr \| number
softness: Expr \| number
/** The points precomputed each frame by `scatteredAnchors`. When given, `drift`, `aspect` and `time` are ignored here. */
anchors?: Expr

}` | |

Example

const t = scatterField({at: uv, count: uniformOf(p('count'), params), seed, drift: uniformOf(p('drift'), params), aspect, time, softness: 3})
return standardPalette(t, params)

See also

  • scatteredAnchors — Computes the scatterField points once per frame instead of once per pixel.
  • wrapRamp — Runs a palette value back and forth cycles times so a ramp repeats without a seam.
  • standardPalette — The color for a 0–1 value from the standard palette props: colorA, colorB, stops, colorSpace.

Used by

MeshGradient