Pardon the mess, Play My Code is in beta!

READY TO PLAY?
CLICK TO LOG IN!

sign up - lost password

fillInnerSegment

Fills a circle segment, around the location given, just like 'fillSegment'. This differs by allowing you to specify an inner radius, which is emptied out from inside the segment, when it is drawn. You can imagine it is like a wide outline of a circle.

fillInnerSegment( x, y, innerRadius, radius, startAngle, endAngle, isCentred = false )

The default function for filling the inner segment. It is drawn around the 'x', 'y' location. 'radius' is the radius of the circle around that location, whilst the sector of the circle is drawn from 'startAngle' to 'endAngle'.

The width of the segment will be the 'radius' minus the 'innerRadius'.

Angles are in radians, and they are drawn clockwise.

/**
 * Fills spinning arcs.
 */

baseAngle = 0
onEachFrame() do |delta|
    fill( :pink )
    
    baseAngle = baseAngle - delta/2
    x = getScreenWidth()/2
    y = getScreenHeight()/2
    
    setColor( :white )
    
    3.times() do |i|
        angle = baseAngle + 120*i
        endAngle = angle + 60
        
        fillInnerSegment( x, y, 140, 180,
                angle.toRadians(), endAngle.toRadians(), true )
    end
end

fillInnerSegment( x, y, innerRadius, radius, startAngle, endAngle, xAlign, yAlign )

This is the same as the previous 'fillInnerSegment', but allows you to set how the segment is aligned across the x and y axis, when drawn.

See Also