VFX-JS
    Preparing search index...

    Type Alias VFXPostEffect

    Configuration for post effects that are applied to the final canvas output.

    type VFXPostEffect = {
        shader?: ShaderPreset | string;
        uniforms?: VFXUniforms;
        persistent?: boolean;
        float?: boolean;
        glslVersion?: GlslVersion;
        effect?: Effect | readonly Effect[];
    }
    Index

    Properties

    shader?: ShaderPreset | string

    Fragment shader code or preset name to be applied as a post effect.
    You can pass a preset name from ShaderPreset (e.g., "invert", "grayscale", "sepia")
    or provide custom shader code.

    The shader will receive the whole canvas as sampler2D src.

    Standard uniforms available:

    • sampler2D src: The input texture (rendered canvas)
    • vec2 resolution: Canvas resolution in pixels
    • vec2 offset: Offset values
    • vec4 viewport: Viewport information
    • float time: Time in seconds since VFX started
    • vec2 mouse: Mouse position in pixels
    • sampler2D backbuffer: Previous frame texture (if persistent is enabled)

    Optional: shader and effect are mutually exclusive.
    If both are present, effect takes precedence.

    uniforms?: VFXUniforms

    Custom uniform values to be passed to the post effect shader.
    Works the same way as element uniforms.

    persistent?: boolean

    Whether the post effect should persist across frames.
    If enabled, the previous output is available as sampler2D backbuffer.

    float?: boolean

    Use 32-bit floating point render target. (Default: false)

    glslVersion?: GlslVersion
    effect?: Effect | readonly Effect[]

    Effect (or pipeline of effects) to apply in this post-effect slot.