Type Function Return value Number Revision Release 2025.3721 Keywords animation, timeline, interpolation, getPosition See also object:setPosition() animation.setPosition() Timeline animation.*
The object:getPosition() method returns the position of the Timeline in milliseconds.
This value may be greater than the duration of the timeline, essentially indicating that all child tweens have completed. If necessary, the returned value can be constrained to a range between 0 and the timeline’s duration by passing true to the method call — see below for details.
object:getPosition( [getClipped] )
Boolean. If true, the returned value will be between 0 and the timeline duration. Default is false.
local object1 = display.newRect( 50, 50, 100, 100 )
-- Create a timeline object
local timelineParams = {
tweens = {
{ startTime=0, tween={ object1, { x=400 }, { time=4000, iterations=5 } } },
{ startTime=1000, tween={ object1, { y=400 }, { time=4000, easing=easing.outQuad } } }
}
}
local newTimeline = animation.newTimeline( timelineParams )
-- Set the timeline playing
newTimeline:resume()
-- Sometime later, pause the timeline
newTimeline:pause()
-- Check the timeline position
local currentPosition = newTimeline:getPosition()
print( currentPosition )