It looks like you're new here. If you want to get involved, click one of these buttons!
Arc = gideros.class(Shape) function Arc:init(t) local x = t.x or t.y or 0 local y = t.y or t.x or 0 local fillStyle = t.fillStyle or { Shape.SOLID, 0x000000, 0.5 } local lineStyle = t.lineStyle or { 2, 0xffffff, 0.5 } local xradius = t.xradius or t.radius or 100 local yradius = t.yradius or t.radius or 100 local sides = t.sides or (xradius + yradius)/2 local startAngle = t.startAngle or 0 local arcAngle = t.arcAngle or 1 self:setFillStyle(unpack(fillStyle)) self:setLineStyle(unpack(lineStyle)) local angleStep = arcAngle / sides self:setPosition(x,y) local xx = math.cos(startAngle*2*math.pi) * xradius local yy = math.sin(startAngle*2*math.pi) * yradius self:beginPath() self:moveTo(xx, yy) for i = 1,sides do local angle = startAngle + i * angleStep self:lineTo(math.cos(angle*2*math.pi) * xradius, math.sin(angle*2*math.pi) * yradius) end self:endPath() if t.alpha then self:setAlpha(t.alpha) end if t.parent then t.parent:addChild(self) end return self end Arc.new{x=xy,y=xy+radius+6,xradius=radius, yradius=radius/8, sides=sides, fillStyle = { Shape.SOLID, 0x000000, 0.3 }, lineStyle = { 0, 0xffffff, 0.3 }, parent = stage} Arc.new{x=xy+offset,y=xy+offset,radius=radius,sides=sides, fillStyle = { Shape.SOLID, 0x000000, 0.8 }, lineStyle = { 4, 0x000000, 0.3 }, parent = stage} Arc.new{x=xy,y=xy,radius=radius, sides=sides, fillStyle = { Shape.SOLID, 0x0000ff, 0.8 }, lineStyle = { 8, 0xffffff, 0.3 }, parent = stage} Arc.new{x=xy+offset,y=xy+offset,radius=radius/2,sides=sides, fillStyle = { Shape.SOLID, 0x000000, 0.8 }, lineStyle = { 4, 0x000000, 0.3 }, parent = stage} Arc.new{x=xy,y=xy,radius=radius/2, sides=sides, fillStyle = { Shape.SOLID, 0x00ff00, 0.8 }, lineStyle = { 2, 0xffffff, 0.3 }, parent = stage} Arc.new{x=400, y=100, radius=20, startAngle=-.25, arcAngle=0.5, parent = stage} Arc.new{x=400, y=120, radius=20, startAngle=-.25, arcAngle=-0.5, parent = stage} Arc.new{x=400, y=140, radius=20, startAngle=-.25, arcAngle=0.5, parent = stage} Arc.new{x=400, y=180, radius=20, startAngle=-.25, arcAngle=-0.5, parent = stage} Arc.new{x=xy,y=xy,radius=radius*2, sides=sides, fillStyle = { Shape.SOLID, 0x00cccc, 0.8 }, lineStyle = { 2, 0xffffff, 0.3 }, arcAngle=-0.5, parent = stage} Arc.new{x=250,y=450,xradius=250, yradius=200/8, fillStyle = { Shape.SOLID, 0x000000, 0.3 }, lineStyle = { 0, 0xffffff, 0.3 }, parent = stage} |
Likes: riyann68, uncleking, ianchia
Dislikes: shandiaobd