scatteredAnchors
Computes the scatterField points once per frame instead of once per pixel.
scatteredAnchors(
params: GpuFragmentParams,
slots: {count: PropRef; seed: PropRef; drift: PropRef; field: string},
): Expr
Import paint from shaders/std and use paint.scatteredAnchors.
Declare a field on the definition, extraFields: {meshAnchors: {schema: schema.arrayOf(schema.vec4f, 4), initial: new Array(16).fill(0)}}, name it in field, and pass the result as anchors to scatterField. The points follow the layer's clock, so declare animatedTime.
Parameters
| Name | Type | Notes |
|---|---|---|
params | GpuFragmentParams | |
slots | {count: PropRef; seed: PropRef; drift: PropRef; field: string} |
Example
const anchors = scatteredAnchors(params, {count: p('count'), seed: p('seed'), drift: p('drift'), field: 'meshAnchors'})
const t = scatterField({at: uv, count: uniformOf(p('count'), params), seed, drift: 0, aspect: 1, time: 0, softness: 3, anchors})
See also
scatterField— A mesh-gradient field: up to 8 drifting points scattered across the canvas, blended by nearness.