Type Function Return value none Revision Release 2025.3721 Keywords animation, tween, timeline, interpolation, pause See also Animation — Tweens and Timelines (guide) animation.resume() Tween Timeline
The animation.pause() function pauses the following, depending on the passed parameter:
Calls to this method which target specific child tweens within a Timeline are ignored. Timeline tweens are controlled/owned by the parent timeline, so you should pause the timeline itself via this method or object:pause().
animation.pause() animation.pause( tweenObject ) animation.pause( displayObject ) animation.pause( tagName ) animation.pause( timelineObject )
DisplayObject. The display object upon which all associated tweens will be paused.
String. The tag name; all tweens/timelines with this tag will be paused.
local object1 = display.newRect( 50, 50, 100, 100 )
local object2 = display.newRect( 50, 150, 100, 100 )
local tween1 = animation.to( object1, { y=300 }, { time=400 } )
local tween2 = animation.to( object2, { y=400 }, { time=200 } )
-- Sometime later, pause all tweens and timelines
animation.pause()
local object1 = display.newRect( 50, 50, 100, 100 )
local object2 = display.newRect( 50, 150, 100, 100 )
local tween1 = animation.to( object1, { y=300 }, { time=400 } )
local tween2 = animation.to( object2, { y=400 }, { time=200 } )
-- Sometime later, pause a specific tween
animation.pause( tween1 )
local object1 = display.newRect( 50, 50, 100, 100 )
local tween1 = animation.to( object1, { y=300 }, { time=2000 } )
local tween2 = animation.to( object1, { rotation=90 }, { time=1000, delay=1000 } )
-- Sometime later, pause all tweens on the object
animation.pause( object1 )
local object1 = display.newRect( 50, 50, 100, 100 )
local object2 = display.newRect( 50, 150, 100, 100 )
local tween1 = animation.to( object1, { y=300 }, { time=400, tag="tweenTag" } )
local tween2 = animation.to( object2, { y=400 }, { time=200, tag="tweenTag" } )
-- Sometime later, pause all tweens with the tag "tweenTag"
animation.pause( "tweenTag" )
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
animation.pause( newTimeline )