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).
Arcs PolyArc

Arc

Creates a new arc using lines.

ssk.display.arc(group, x, y [ , params ] )

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 ] )

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 )


RoamingGamer Copyright © Roaming Gamer, LLC. 2008-2016; All Rights Reserved