object:resume()

类型 函数
返回值
修订 版本 2024.3703
关键词 动画, 时间轴, 插值, 恢复
另请参阅 object:pause()
animation.pause()
animation.resume()
时间轴
animation.*

概述

恢复使用 animation.newTimeline() 创建的已暂停的 时间轴,包括其中的所有子补间动画。

此方法也可用于开始播放新的 时间轴,因为时间轴在创建后不会自动开始播放。

语法

object:resume()

示例

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

-- After 2 seconds, pause the timeline
timer.performWithDelay( 2000, function() newTimeline:pause(); end )

-- Sometime later, resume the timeline
newTimeline:resume()