transition.moveBy()

Type Function
Library transition.*
Return value Object
Revision Current Public Release (2017.3068)
Keywords easing, animation, transition, tween, interpolation

Overview

Moves an object by the specified x and y coordinate amount over a specified time.

Syntax

transition.moveBy( 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 the next section for details.

Parameter Reference

x (optional)

Number. The x coordinate amount to move the object by.

y (optional)

Number. The y coordinate amount to move the object by.

time (optional)

Number. The time of the action.

tag (optional)

String. Specifies the transition tag. The transition library can pause, resume, or cancel transitions sharing the same tag.

transition (optional)

Function. Specifies the easing interpolation method. Default is linear.

delay (optional)

Number. Specifies the delay, in milliseconds, before the transition begins. Default is 0.

onStart (optional)

Listener. Listener function to be called before the transition begins. This function will receive a reference to the associated object as its sole argument.

onComplete (optional)

Listener. Listener function to be called after the transition completes. This function will receive a reference to the associated object as its sole argument.

onPause (optional)

Listener. Listener function to be called when the transition is paused. This function will receive a reference to the associated object as its sole argument.

onResume (optional)

Listener. Listener function to be called when the transition is resumed. This function will receive a reference to the associated object as its sole argument.

onCancel (optional)

Listener. Listener function to be called when the transition is cancelled. This function will receive a reference to the associated object as its sole argument.

Examples

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

transition.moveBy( square, { x=100, y=100, time=2000 } )