4 frame animation

I have 4 frames of an animation of stars that appear on screen in a random area. It works, accept it only shows my 4th frame

1
2
3
4
5
6
7
8
9
10
11
                                                          function spawnStars()
                                                     local sunbeam = movieclip.newAnim{ "images/stars1.png", "images/stars2.png", "images/stars3.png", "images/stars4.png" }
                                                     sunbeam.x = math.random(350, 430)
                                                     sunbeam.y = math.random(80, 160)
                                                     sunbeam:scale(3, 1.5)              
                                                     if audioset == 1 then
                                                        audio.play( fireworkSound )
                                                     end 
                                                    transition.to( sunbeam:play{startFrame=1, endFrame=4,loop=1, remove=true}, { time=1000,  x=sunbeam.x + math.random(-50, 50 ),alpha=1.0 } ) 
                                               end
                                                   timer.performWithDelay ( 400, spawnStars, 8 )

I don't think that Corona supports transition that way. And logically, you are calling a function when you use sunbeam:play(), which doesn't return an object that is needed for transition.

You need to separate your sequence and just have sunbeam inside the transition.to(). If you play your sunbeam the line before or after you won't be able to notice a difference in the starting times between the play and the transition, and it will only play 1 loop.

views:1311 update:2011/12/29 9:44:01
corona forums © 2003-2011