← Back to Docs
  • index.html
  • Clayground
  • Clayground.World
  • ScreenFx2d
  • Clayground 2026.8
  • ScreenFx2d QML Type

    Screen effects for a ClayWorld2d: vignette, colour grade, flash, chromatic aberration, low-health warning, grain and posterise. More...

    Import Statement: import Clayground.World

    Properties

    Methods

    Detailed Description

    Place it as a child of ClayWorld2d and set world. It works on the world's canvas only - the world with its LightLayer2d - so HUD items declared beside it in the world stay untouched as long as their z is above the ScreenFx2d's.

    ClayWorld2d {
        id: theWorld
        // ...
        ScreenFx2d {
            id: fx
            world: theWorld
            vignette: 0.6
            lowHealth: player.health < 30 ? 1 - player.health / 30 : 0
        }
        // on a hit
        // fx.flash("white", 90); fx.pulse(0.6, 250)
    }

    Every property can be animated. Two passes, each skipped when it has nothing to do:

    See also LightLayer2d and ClayWorld2dCamera.

    Property Documentation

    aberration : real

    Standing chromatic aberration in 0..1; 0 is off.

    Adds to what pulse() is currently showing.


    brightness : real

    Added to every channel; 0 is neutral.


    colorLevels : int

    Posterises the brightness to this many levels, for a retro look; 0 is off. The hue is kept, so dark scenes do not shift colour.


    contrast : real

    Contrast around mid grey; 1 is neutral.


    dither : real

    Ordered dither applied with colorLevels, in 0..1.


    gradeActive : bool [read-only]

    True while the world is rendered through the grade pass.


    grain : real

    Film grain in 0..1; 0 is off.


    lowHealth : real

    Low-health warning in 0..1: desaturates the world and beats a red edge. Bind it to the player's health.


    maxAberrationPx : real

    Channel offset at the screen corners, in pixels, for an aberration of 1.


    overlayActive : bool [read-only]

    True while the overlay pass is drawn.


    saturation : real

    Saturation; 1 is neutral, 0 is greyscale.


    sourceItem : Item

    The item the grade reads and hides; defaults to the world's picture - its canvas, or the held frame of a view-only hit stop. The effect covers the ScreenFx2d's own geometry, which fills its parent.


    temperature : real

    Colour temperature in -1 (cold, blue) .. 1 (warm, orange); 0 is neutral.


    tint : color

    Multiplies the world colour; white is neutral.


    vignette : real

    Vignette strength in 0..1; 0 is off.


    vignetteColor : color

    Colour the edges fade to.


    vignetteRadius : real

    Where the vignette starts, as a fraction of the centre-to-corner distance.


    vignetteSoftness : real

    Width of the vignette falloff, same unit as vignetteRadius.


    world : var

    The ClayWorld2d whose canvas is processed.


    Method Documentation

    object clayInspect()

    Reports which passes run and every knob as plain JSON, for tooling. Pull-only and side-effect free.


    void flash(color color, int ms, real strength)

    Covers the screen with color and fades it out over ms milliseconds (default 120). strength (default 0.8) is the opacity at the start. A flash does not cut short a stronger one still running.


    void pulse(real amount, int ms)

    A burst of chromatic aberration of amount (0..1) that decays over ms milliseconds (default 250) - for a strong hit or a parry. A weaker pulse does not cut short a stronger one.