Skip to content

pixelate

pixelate(inputUV, resolution, pivot): Node<"vec2">

Defined in: packages/nodes/src/sprite/pixelate.ts:25

Pixelate UV coordinates by snapping to a pixel grid.

Parameters

inputUV

Node<"vec2">

The UV coordinates to transform

resolution

Vec2Input

Pixel grid resolution as [width, height] or vec2 node

pivot

Vec2Input = ...

Center point for pixelation (default: [0.5, 0.5] = center)

Returns

Node<"vec2">

Pixelated UV coordinates (snapped to grid centers)

Examples

// Pixelate to 16x16 grid (centered)
pixelate(uv(), [16, 16])
// Animate pixelation with uniform (stays centered)
pixelate(uv(), resolutionUniform)
// Pixelate from top-left corner
pixelate(uv(), [16, 16], [0, 1])