Skip to content

spriteUV

spriteUV(frame): Node<"vec2">

Defined in: packages/nodes/src/sprite/sampleSprite.ts:91

Get the UV coordinates for a sprite frame. Useful when you need the UV separately (e.g., for outline effects that sample neighbors).

Parameters

frame

Vec4Input

Frame bounds as [x, y, width, height] in UV space (0-1), or a vec4 uniform

Returns

Node<"vec2">

Transformed UV coordinates for the frame

Example

const frameUV = spriteUV(frameUniform)
const color = texture(tex, frameUV)
return outline8(color, frameUV, tex, { color: [0, 1, 0, 1] })