Type Function Return value Number Revision Release 2024.3703 Keywords animation, timeline, interpolation, getDuration See also Timeline animation.*
The object:getDuration()
method returns the duration of the Timeline in milliseconds.
This value will be affected by the timeline’s speed scale.
In the instance of an endless timeline (infinite iterations on a child tween), this value will be nil
because there is effectively no
object:getDuration()
local object1 = display.newRect( 50, 50, 100, 100 ) -- Create a timeline object local timelineParams = { tweens = { { startTime=1000, tween={ object1, { x=400 }, { time=4000, iterations=5 } } }, { startTime=2000, tween={ object1, { y=400 }, { time=4000, easing=easing.outQuad } } } }, delay = 1000 } local newTimeline = animation.newTimeline( timelineParams ) -- Set the timeline playing newTimeline:resume() -- Get the timeline's playing duration local duration = newTimeline:getDuration() print( duration ) --> 21000