hi,
I would have multiple transition on the same time so i use a table view but the problem is that this animation is not callable at 100%… i don’t find the solution to have a snippet that works. There is always a little bug where all the star are displayed on the screen i have put a video to show that. Thanks if you could help me.
local Backgroundinvisible = display.newImageRect("back01.png", display.actualContentWidth,display.actualContentHeight) Backgroundinvisible.myId = 200 Backgroundinvisible.x, Backgroundinvisible.y= display.actualContentWidth\*.5,display.actualContentHeight\*.5 Backgroundinvisible.alpha = 1 local mathr = math.random -------------------------------------------------------------------------------------------------------------------------------- -- NECESSARY -------------------------------------------------------------------------------------------------------------------------------- local numberofstarAnim = 3 local numberofstar = 300 local refX, refY = 200,200 local flag = true -- STAR EXPLODE local star = {} for a=1,numberofstar do star[a] = display.newImageRect( "star.png",40,40 ) for i=1, numberofstar do star[a].x=mathr(100,300) star[a].y=mathr(100,300) end star[a].alpha = 0 --.5 star[a].xScale=1 star[a].yScale = 1 star[a].flag = true end --for local function starExplode() -- a= var if flag then flag=false print("starexplode") local countStarExplode = 0--test starExplode for b = 1, #star do if (star[b].flag == true ) then--conditions pour filtrer countStarExplode = countStarExplode + 1 if countStarExplode == numberofstarAnim then flag=true for a=1, b do star[a].flag = false local function beginAnimStar() star[a].alpha = 1 --.5 end --beginAnimStar local function returnFlagToStar() print("returnFlagToStar") if star[a].flag == false then star[a].flag = true end end local function finishTheTransition() star[a].transition=transition.to(star[a],{time=500,alpha =0}) end--finishtheTransition beginAnimStar() timer.performWithDelay(501, finishTheTransition) print("end") end end--if end--if end--for end--if end--function -- LISTENER ----------------------------------------------------- local function tapOnBackground(event) --touchk if event.phase == "ended" then target = event.target if target.myId == 200 then print "touch" starExplode() end --if end --if return true end Backgroundinvisible:addEventListener("touch", tapOnBackground)
