Skip to content

ShaderOptions

shader()’s options.

fragment: string

A GLSL ES 1.00 fragment shader: declare your own uniforms and write main(). The engine declares, before it:

uniform sampler2D uTexture; // the node drawn so far (premultiplied alpha) varying vec2 vUv; // where this pixel is in uTexture, 0–1, (0, 0) bottom-left uniform vec2 uResolution; // uTexture’s size, pixels uniform float uTime; // engine.time, seconds (stops on pause) uniform vec4 uRect; // the node’s area in uTexture (x0, y0, x1, y1), 0–1

Write a premultiplied colour to gl_FragColor; the engine applies the node’s alpha after it.


optional uniforms?: Record<string, number | number[]>

Your uniforms (float, vec2–vec4) by name: numbers or arrays of 2–4. Change them in place any time.


optional padding?: number

How far the effect reaches past the node’s pixels, stage units (a ripple that moves pixels out). Default 0.