pointerTrail

The pointer's recent path as a field in .x (0–1), read by name: trail(uv).x.

pointerTrail(opts: {decay?: number | PropRef; radius?: number | PropRef; resolution?: number} = {}): PointerTrailInput

Import pointerTrail from shaders/std.

decay is how many seconds a mark takes to halve; radius the brush size as a fraction of the height. Both take a number or a prop (p('reach')), read live each frame.

Parameters

NameTypeNotes
opts{decay?: number | PropRef; radius?: number | PropRef; resolution?: number}Optional. Default {}.

Example

inputs: {trail: pointerTrail({decay: 0.6, radius: 0.04})},
effect: wgsl`return mix(child, vec4f(1.0, 0.4, 0.1, 1.0), trail(uv).x);`,