I’m trying to create an infinite loop, But I get stuck in one part.
I have this code
local function doMore () ball = {} for column = 1, 12 do for row = 1, 10 do ball[column] = display.newCircle( math.random(1, 800), math.random(-10, 1000), math.random(10, 50) ) ball[column].alpha = 1 ball[column]:setFillColor(math.random(12, 255),math.random(5, 255),math.random(5, 255)) ball[column].x = math.random(80, 600) + (column\*math.random(80, 500)) ball[column].y = math.random(10, 700) + (row\*math.random(80, 1000)) transition.to(ball[column], {time=20000, x=math.random(24, 5000), y=math.random(80, 2000)}) end end end doMore ()
I want to be able to make all those balls fade out – transition.to alpha = 0 – I guess
using the onComplete
like this
transition.to(ball[column], {time=20000, x=math.random(24, 5000), y=math.random(80, 2000), onComplete=again})
So the new function must have another set of balls, similar to the first one.
but making the first set vanishing little by little (alpha=0)
as the new loop will make another balls )like balls2[column],
when the new balls2 reaches the end, then have a call for the first ball loop and do that cycle forever
like part of a background animation.
Would you please help me out to figure this out.
Thanks