Skip to content

Instantly share code, notes, and snippets.

@tariqkhatib
Created December 6, 2014 23:32
Show Gist options
  • Save tariqkhatib/9362780e814569b1b5e5 to your computer and use it in GitHub Desktop.
Save tariqkhatib/9362780e814569b1b5e5 to your computer and use it in GitHub Desktop.
math.randomseed( os.time( ) )
a={}
i=0
x1=0
y1=0
function trans2(self,theX,theY)
local xx = self.x
local yy = self.y
transition.to( self, {x=theX,y=theY,time=100,onComplete = function() trans1(self,xx,yy) end} )
end
function trans1(self,theX,theY)
local xx = self.x
local yy = self.y
transition.to( self, {x=theX,y=theY,time=500,onComplete = function() trans2(self,xx,yy) end} )
end
function CreateCircle( )
i=i+1
R= math.random( )
G= math.random( )
B= math.random( )
x1 = math.random(1,display.contentWidth )
y1 = math.random(1,display.contentHeight )
x2 = math.random(1,display.contentWidth )
y2 = math.random(1,display.contentHeight )
rD=math.random(1,2)
a[i]=display.newCircle(x1,y1,rD)
a[i]:setFillColor( R,G,B )
transition.to( a[i], {x=x2,y=y2,time=1000,onComplete = function() trans2(a[i],x1,y1) end} )
end
timer.performWithDelay( 100, CreateCircle,0 )
@tariqkhatib
Copy link
Author

just keep it running for minutes... it looks cool and a bit spooky!

@dec0mpiled
Copy link

Looks cool! Maybe can be used for like a main menu for a space game or something :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment