animation.resume()

Type Function
Return value none
Revision Release 2024.3703
Keywords animation, tween, timeline, interpolation, resume
See also Animation — Tweens and Timelines (guide)
animation.pause()
Tween
Timeline

Overview

The animation.resume() function resumes the following, depending on the passed parameter:

Important

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 resume the timeline itself via this method or object:resume().

Syntax

animation.resume()
animation.resume( tweenObject )
animation.resume( displayObject )
animation.resume( tagName )
animation.resume( timelineObject )
tweenObject (optional)

Tween. The specific paused Tween to resume.

displayObject (optional)

DisplayObject. The display object upon which all paused tweens will be resumed.

tagName (optional)

String. The tag name; all paused tweens with this tag will be resumed.

timelineObject (optional)

Timeline. The specific paused Timeline to resume.

Examples

All Tweens/Timelines
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 } )

-- At some point, pause all tweens and timelines
animation.pause()

-- Sometime later, resume them
animation.resume()
Specific Tween
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 } )

-- At some point, pause a specific tween
animation.pause( tween1 )

-- Sometime later, resume it
animation.resume( tween1 )
Display Object Tweens
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 } )

-- At some point, pause all tweens on the object
animation.pause( object1 )

-- Sometime later, resume them
animation.resume( object1 )
Tagged Tweens
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" } )

-- At some point, pause all tweens with the tag "tweenTag"
animation.pause( "tweenTag" )

-- Sometime later, resume them
animation.resume( "tweenTag" )