Hello,
I have a group of display objects that I want to animate contiuously “in the background” while the rest of the game is running. Below is an example of an animation. As you can see, there are a sequence of transitions that end up with a recursive call to the same method to continue the animation. There are also other animations with more complex animation patterns. The problem is that after a few seconds of execution, the memory usage shoots through the roof and the whole thing just freezes…
I have tried to put it in a runtime event listener, but since the animations consist of a sequence of transitions and delays, I could not get it to work.
The question is: what is the proper way to iterate continuously over an animation sequence?
[lua]
function pulsateObject()
if(pulsateGroup ~= nil)then
for i=1, #pulsateGroup do
transition.to(pulsateGroup[i], {time = 700, xScale=0.9, yScale=0.9, onComplete=function()
transition.to(pulsateGroup[i], {time = 700, xScale=1.0, yScale=1.0, onComplete = function ()
pulsateObject()
end})
end})
end
end
end
[/lua]
Thanks in advance for your help!