Mask
Adding a mask to a Sprite or Texture ensures it only renders what's within the outline of the mask shape.
Important
Nested masks (using a mask within a Sprite which already has a mask) are currently not supported.
#
Circle Mask#
ExampleMasks are drawn relative to the
x
andy
props of the texture / Sprite applied to. In this case, the mask would have anx
of 60 in the parent Sprite's coordinates.
#
Propsradius
: Radius of the circle in game coordinates.x
: (Optional) x coordinate of circle. Default0
.y
: (Optional) y coordinate of circle. Default0
.
#
Rectangle Mask#
Example#
Propswidth
: Width of the rectangle in game coordinates.height
: Height of the rectangle in game coordinates.x
: (Optional) x coordinate of rectangle. Default0
.y
: (Optional) y coordinate of rectangle. Default0
.
#
Line Mask#
Example#
Propspath
: An array of[x, y]
coordinates to draw the mask shape outline.x
: (Optional) x coordinate of line. Default0
.y
: (Optional) y coordinate of line. Default0
.