Phaser API Documentation

slice(x, y, radius, startAngle, endAngle, [anticlockwise], [overshoot])


Creates a pie-chart slice shape centered at x, y with the given radius. You must define the start and end angle of the slice.

Setting the anticlockwise argument to true creates a shape similar to Pacman. Setting it to false creates a shape like a slice of pie.

This method will begin a new path and close the path at the end of it. To display the actual slice you need to call either strokePath or fillPath after it.


name type arguments Default description
x number

The horizontal center of the slice.

y number

The vertical center of the slice.

radius number

The radius of the slice.

startAngle number

The start angle of the slice, given in radians.

endAngle number

The end angle of the slice, given in radians.

anticlockwise boolean <optional> false

Whether the drawing should be anticlockwise or clockwise.

overshoot number <optional> 0

This value allows you to overshoot the endAngle by this amount. Useful if the arc has a thick stroke and needs to overshoot to join-up cleanly.


This Game Object.

Since: 3.4.0