copy paste to main.lua
or download and rename file to main.lua
touch screen anywhere or remove finger
i think it can be used for a game somehow but not sure what!
it is good for new corona developers i hope
[lua]
math.randomseed( os.time( ) ) local r=0--red local g=0--green local b=0--blue local a=0--alpha local t=0--time local x1=0--new x location local y1=0--new y location local diameter=0--circle diameter local flag=false--touch flag local function listener(event)--screen touch event if event.phase=="began" then flag=true -- touching began so stop random positioning elseif event.phase=="ended" then flag=false -- touching ended so begin random positioning end x1=event.x y1=event.y end local function meBack(self)--function to transition to new place r=math.random( ) g=math.random( ) b=math.random( ) a=math.random( ) t=math.random( ) \* 700 if flag==false then--if touching is over randomly set new x and y x1=math.random( )\*display.contentWidth y1=math.random( )\*display.contentHeight end circle:setFillColor(r,g,b) circle.alpha=a transition.to( self, {x=x1,y=y1,time=t,onComplete=meBack} ) end for i=1,300 do -- it could be any number as long as number of circles does not affect performance r=math.random( ) g=math.random( ) b=math.random( ) a=math.random( ) x1=math.random( )\*display.contentWidth y1=math.random( )\*display.contentHeight diameter=math.random()\*2 circle = display.newCircle(x1,y1,diameter) circle:setFillColor(r,g,b) circle.alpha=a transition.to( circle, {x=x1,y=y1,time=100,onComplete=meBack} ) end Runtime:addEventListener( "touch", listener )
[/lua]