Skip to content

Glitch API

Glitch

Extends Effect.

Factory Function

typescript
createGlitch(config?: GlitchConfig)

Methods

See Effect for the full method reference.


GlitchConfig

typescript
interface GlitchConfig {
    color?: string;
    intensity?: number;
    noiseBlocks?: boolean;
    rgbSplit?: number;
    scale?: number;
    scanlines?: boolean;
    sliceDisplacement?: boolean;
    speed?: number;
}
PropertyTypeDefaultDescription
colorstring'#00ff00'Primary color for glitch artifacts and scanlines.
intensitynumber0.5Overall strength of glitch artifacts (0–1).
noiseBlocksbooleantrueEnable random rectangular noise blocks.
rgbSplitnumber3Maximum pixel offset for RGB channel separation.
scalenumber1Scales all sizes proportionally.
scanlinesbooleantrueEnable horizontal scanline overlay.
sliceDisplacementbooleantrueEnable horizontal slice displacement bands.
speednumber1Animation speed multiplier.

GlitchSlice

typescript
interface GlitchSlice {
    height: number;
    offset: number;
    y: number;
}
PropertyTypeDescription
heightnumberHeight of the displaced slice in pixels.
offsetnumberHorizontal displacement offset in pixels.
ynumberVertical position of the slice.

GlitchBlock

typescript
interface GlitchBlock {
    height: number;
    opacity: number;
    width: number;
    x: number;
    y: number;
}
PropertyTypeDescription
heightnumberHeight of the noise block.
opacitynumberOpacity of the noise block.
widthnumberWidth of the noise block.
xnumberHorizontal position.
ynumberVertical position.