object:cancel()

类型 函数
返回值
修订版 版本 2024.3703
关键词 动画、时间轴、插值、取消
另请参阅 animation.cancel()
时间轴
animation.*

概览

取消使用 animation.newTimeline() 创建的 时间轴,包括其中所有子级动画。

语法

object:cancel()

示例

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()