Pardon the mess, Play My Code is in beta!

READY TO PLAY?
CLICK TO LOG IN!

sign up - lost password

fillSegment

Fills a segment of a circle, around the x/y location given. All angles for 'fillSegment' are given in radians, and it draws the segment in a clockwise direction.

fillSegment( x, y, radius, startAngle, endAngle, isCentred = false )

Fills a segment of a circle, around the x and y location.

The 'radius' refers to the distance from the middle of the circle that contains the segment, to the outer edge.

'isCentred' defines if the x and y location is the top left corner, or the middle.

/**
 * Displays a segment which slowly fills.
 * It then repeats.
 */

angle = 0
onEachFrame() do |delta|
    fill( :pink )
    
    angle = (angle+delta) % 360
    
    setColor( :white )
    fillSegment( getScreenWidth()/2, getScreenHeight()/2,
            150, 0, angle.toRadians(), true )
end

fillSegment( x, y, radius, startAngle, endAngle, xAlign, yAlign )

Fills a circle segment, but allows you to specify alignment on the x and y axis.

See the article on How Alignment Works for information on the xAlign and yAlign parameters.

See Also