object:getSpeedScale()

Type Function
Return value Number
Revision Release 2024.3703
Keywords animation, tween, interpolation, getSpeedScale
See also object:setSpeedScale()
animation.setSpeedScale()
Tween
animation.*

Overview

The object:getSpeedScale() method returns the speed scale of the Tween as set via object:setSpeedScale() or animation.setSpeedScale().

Syntax

object:getSpeedScale()

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 speed scale
newTween:setSpeedScale( 2.5 )

-- Get the speed scale
local currentSpeedScale = newTween:getSpeedScale()
print( currentSpeedScale )  --> 2.5