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#
Example#
Masks are drawn relative to the
xandyprops of the texture / Sprite applied to. In this case, the mask would have anxof 60 in the parent Sprite's coordinates.
Props#
radius: Radius of the circle in game coordinates.x: (Optional) x coordinate of circle. Default0.y: (Optional) y coordinate of circle. Default0.
Rectangle Mask#
Example#
Props#
width: 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#
Props#
path: 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.