Skip to content

trail

trail(tex, uv, direction, length, samples, falloff): Node<"vec4">

Defined in: packages/nodes/src/vfx/trail.ts:22

Create motion trail effect by sampling previous positions. Samples the texture at offset positions to create a trailing effect.

Parameters

tex

Texture

Source texture

uv

Node<"vec2">

Current UV coordinates

direction

Vec2Input

Trail direction (normalized vec2 or [x, y])

length

FloatInput = 0.1

Trail length in UV space (default: 0.1)

samples

number = 4

Number of trail samples (default: 4)

falloff

FloatInput = 2

How quickly trail fades (default: 2)

Returns

Node<"vec4">

Color with motion trail

Example

// Horizontal motion trail
const trailed = trail(texture, uv, [1, 0], 0.1, 4)