the camera to apply the transition to
transition parameters, see MaskEffectOptions
The settings of a MaskEffect, as its constructor takes them.
Optionalcenter?: MaskCenterwhere the shape closes and opens: a renderable (where it is drawn when the effect starts) or a point in the camera's screen coordinates. The centre of the screen by default
CSS color value or Color instance for the transition fill
Optionaldirection?: "hide" | "reveal""hide" covers the scene (the default), "reveal" uncovers it
Optionalduration?: numbertransition duration in milliseconds (500 by default)
Optionalinvert?: booleanmake the shape the cover rather than the window: it grows out of
center to hide the scene
OptionalonComplete?: () => voidcallback when the transition finishes
Optionalshape?: MaskShapean Ellipse or Polygon (unit-sized), an image or the name of a
preloaded one, or a Sprite; an iris when omitted
the camera this effect is attached to
the point the shape closes on and opens from, in the camera's screen
coordinates, read when the effect started; undefined for the centre
of the screen
the transition fill color
transition direction
the transition duration, in milliseconds
true when the shape is the cover rather than the window: it grows
to hide the scene and shrinks to reveal it
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)
optional callback when transition completes
current progress value (0 = fully covered, 1 = fully visible)
the shape as given: an Ellipse or Polygon template, an image, the
name of one, or a sprite; undefined for the default iris
the tween controlling progress
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).
Called each frame to update the effect state (e.g. modify camera offset, countdown duration).
A camera effect that performs a mask-based scene transition.
A shape closes on a point to hide the scene, filling the screen around it with a solid color, and opens from it again to reveal the scene. The shape can be:
Ellipse(an iris, the default) or aPolygon, unit-sized and centred on its origin;Sprite: the silhouette of the frame it shows when the effect starts, facing the way it faces (not its scale or rotation: the shape is grown to the screen's size anyway).The shape grows and shrinks about its thickest part (the origin of a unit
PolygonorEllipse), and that point sits on the centre of the screen, or oncenter: a renderable, at the place it is drawn when the effect starts, such as the player. Withinvert, the shape is the cover instead of the window: filled with the color, it grows out of that point until it covers the screen, and shrinks away to reveal it.Whatever the shape and the point, the shape is grown until it holds the whole screen, so a reveal ends with the scene fully uncovered. It is drawn with plain images and fills, the same on every renderer. A shape that cannot be used (an unknown image name, an image that cannot be read, an empty one, a destroyed sprite) warns once and is an iris instead.
Example
Example
Example
Example
Example