transition.from()

Type Function
Library transition.*
Return value Table
Revision Release 2024.3703
Keywords easing, animation, transition, tween, interpolation
See also Transitions (guide)
easing

Overview

Similar to transition.to() except that the starting property values are specified in the parameters table and the final values are the corresponding property values of the object prior to the call.

Syntax

transition.from( target, params )
target (required)

Table. Any object that behaves like a table, for example display objects.

params (required)

Table. A table that specifies the properties of the transition. See transition.to() for parameter references.

Examples

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