Arc Factories (ssk.display.*)
This library contains two functions for creating arc objects:
| ssk.display.arc | ssk.display.polyArc |
| Creates a new arc using lines. | Creates a new arc using display.newPolygon (external link). |
![]() |
![]() |
Arc
Creates a new arc using lines.
ssk.display.arc(group, x, y [ , params ] )
group- Group to add arc object to.x,y- < x, y > center of arc.params- Table of arc properties.s(0) - Start angle where 0 is up, 90 is right, ...sweep(360) - Angle sweep, where 360 is a full circle.radius(100) - Radius of arc.strokeColor(_W_) - Color of arc line.strokeWidth(4) - Width/thickness of arc line.incr(1) - Degrees to increment by per step,- May be any value in range: (-360,360) except 0
Example
local spinGroup = display.newGroup()
group:insert(spinGroup)
spinGroup.x = centerX - 300
spinGroup.y = centerY - 50
ssk.display.arc( spinGroup, 0, 0 ,
{ radius = 50, s = 0, sweep = 90,
strokeColor = _R_, strokeWidth = 6 })
ssk.display.arc( spinGroup, 0, 0 ,
{ radius = 50, s = 90, sweep = 90,
strokeColor = _G_, strokeWidth = 6 })
ssk.display.arc( spinGroup, 0, 0 ,
{ radius = 50, s = 180, sweep = 90,
strokeColor = _B_, strokeWidth = 6 })
ssk.display.arc( spinGroup, 0, 0 ,
{ radius = 50, s = 270, sweep = 90,
strokeColor = _Y_, strokeWidth = 6 })
function spinGroup.enterFrame( self )
self.rotation = self.rotation + 5
end; listen("enterFrame", spinGroup)
-- Poly Arcs
ssk.display.polyArc( group, centerX-150, centerY-50,
{ radius = 50, s = 0, sweep = 180, incr = -0.25, fillColor = _O_ } )
ssk.display.polyArc( group, centerX-50, centerY-50,
{ radius = 50, s = 45, sweep = 180, incr = -0.25, fillColor = _P_ } )
PolyArc
Creates a new arc (more of a semi-circle/pie-chart shape actually) using display.newPolygon (external link).
ssk.display.polyArc(group, x, y [ , params ] )
group- Group to add arc object to.x,y- < x, y > center of arc.params- Table of arc properties.s(0) - Start angle where 0 is up, 90 is right, ...sweep(360) - Angle sweep, where 360 is a full circle.radius(100) - Radius of arc.fillColor(_W_) - Fill color for body of arc polygon.strokeColor(_W_) - Color of arc line.strokeWidth(0) - Width/thickness of arc line.incr(1) - Degrees to increment by per step,- May be any value in range: (-360,360) except 0
Example
local pac
local curSep = 90
local curDir = -15
local function chomp()
display.remove(pac)
pac = ssk.display.polyArc( group, centerX - 200, centerY + 100,
{ radius = 50, s = 90 - curSep/2, sweep = 360 - curSep, incr = -0.1, fillColor = _Y_ } )
curSep = curSep + curDir
if( curSep <= 0 ) then
curSep = 0
curDir = 15
elseif( curSep >= 90 ) then
curSep = 90
curDir = -15
end
end
timer.performWithDelay( 30, chomp, -1 )
Copyright © Roaming Gamer, LLC. 2008-2016; All Rights Reserved

