Hello,
I want to create a loop animation of two objects with the small delay between them. This is the code I wrote:
local function heartbeat() local heart1beat1, heart1beat2 heart1beat1 = function() transition.to(Heart1, {time=130, xScale=1, yScale=1, onComplete=heart1beat2 }) local heartbeat = audio.play( heartBSound ) end heart1beat2 = function() transition.to(Heart1, {delay = 750, time=100, xScale=1.15, yScale=1.15, onComplete=heart1beat1 }) end local heart2beat1, heart2beat2 heart2beat1 = function() transition.to(Heart2, {time=130, xScale=1, yScale=1, onComplete=heart2beat2 }) end heart2beat2 = function() transition.to(Heart2, {delay = 750, time=100, xScale=1.1, yScale=1.1, onComplete=heart2beat1 }) end heart1beat1() timer.performWithDelay( 300, heart2beat1) end heartbeat()
It works but after some time the delay doesn’t stay the same and the timing gets messed up. I want the loop to stay the same all the time. I guess when I put these two functions one after another it creates a small gap. I am new to Lua, please tell me how can I close the gap?