object:cancel()

Type Function
Return value none
Revision Release 2024.3703
Keywords animation, timeline, interpolation, cancel
See also animation.cancel()
Timeline
animation.*

Overview

Cancels a Timeline created with animation.newTimeline(), including all child tweens within it.

Syntax

object:cancel()

Example

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, cancel the timeline
newTimeline:cancel()