类型 函数 返回值 无 修订 版本 2024.3703 关键词 动画, 补间动画, 时间轴, 插值, 恢复 另请参阅 动画 — 补间动画和时间轴 (指南) animation.pause() 补间动画 时间轴
animation.resume()
函数根据传入的参数恢复以下内容:
调用此方法以定位 时间轴 中的特定子补间动画将被忽略。时间轴补间动画由父时间轴控制/拥有,因此您应该通过此方法或 object:resume() 来恢复时间轴本身。
animation.resume() animation.resume( tweenObject ) animation.resume( displayObject ) animation.resume( tagName ) animation.resume( timelineObject )
显示对象. 将在其上恢复所有暂停补间动画的显示对象。
字符串. 标签名称;所有带有此标签的暂停补间动画都将恢复。
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()
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 )
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 )
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" )