transition.from()

类型 函数
transition.*
返回值
修订版 版本 2024.3703
关键字 缓动、动画、转换、补间、插值
另请参阅 转换(指南)
缓动

概述

类似于 transition.to(),但不同之处在于开始属性值指定在参数表中,而最终值是在调用前对象对应的属性值。

语法

transition.from( target, params )
target (必需)

. 任何像表一样的对象,例如 显示对象

params (必需)

. 指定转换属性的表。请参阅 transition.to() 的参数引用。

示例

local square = display.newRect( 0, 0, 100, 100 )

local w,h = display.contentWidth, display.contentHeight

local function listener( obj )
    print( "Transition completed on object: " .. tostring( obj ) )
end

-- Move square from bottom right corner to upper left corner
transition.from( square, { time=1500, x=(w-50), y=(h-50), onComplete=listener } )