object:setPosition()

Type Function
Return value none
Revision Release 2024.3703
Keywords animation, tween, interpolation, setPosition
See also object:getPosition()
animation.setPosition()
Tween
animation.*

Overview

Moves/sets the playback position of a Tween object.

Syntax

object:setPosition( position )
position (required)

Number. The position (time) to move/set the playback to, in milliseconds.

Example

local object1 = display.newRect( 50, 50, 100, 100 )

-- Move the object
local newTween = animation.to( object1, { x=150, y=400 }, { time=5000 } )

-- Set the tween position
newTween:setPosition( 2000 )