the camera to apply the effect to
effect options
Optionaldirection?: "hide" | "reveal""hide" to break the frame up, "reveal" to bring it back
Optionalduration?: numberexpressed in milliseconds
OptionalonComplete?: () => voidcallback once the effect is over
the renderer drawing the camera
Optionalsize?: numberthe largest blocks, in screen pixels
the camera this effect is attached to
the shader effect this transition drives on the camera, or undefined
on a renderer without shaders (Canvas)
whether this effect has finished and should be removed
whether this effect should persist across camera/game resets (e.g. transition effects that span state changes)
the transition progress, 0 for the sharp frame and 1 for the largest blocks
the largest blocks, at the end of a hide and the start of a reveal, in screen pixels
Called when the effect is removed from the camera. Override to clean up resources.
Called after the scene renders to draw visual overlays (e.g. color fills for fading).
the renderer to draw with
the camera viewport width
the camera viewport height
Called each frame to update the effect state (e.g. modify camera offset, countdown duration).
A camera effect that performs a pixelate scene transition: the frame breaks up into blocks that grow to
sizepixels (hide), or shrink fromsizeback to the sharp frame (reveal).It works on what the camera draws, through a PixelateEffect it puts FIRST in the camera's post-effect chain for as long as it runs, so the effects after it (a vignette, scanlines) stay sharp over the blocks. That is a shader, so on the Canvas renderer the effect does nothing: it adds no shader to the camera and only keeps its timing, and state.transition skips a pixelate transition there altogether.
Example