Speed in transitions

I have to do transitions with different positions, but the speed with which the movement takes place depends on the distance that is to be made.

How do I make all transitions have the same speed regardless of distance? [import]uid: 136125 topic_id: 27415 reply_id: 327415[/import]

You could calculate the total distance and then do an equation to make everything even. A very rough example;

[lua]local obj1 = display.newCircle( 100, 100, 30 )
local obj2 = display.newCircle( 0, 200, 30 )

local speed
local distance
local transX = 300

local function move1()
distance = transX - obj1.x
speed = 2*distance
transition.to(obj1, {time=speed, x=transX})
end

local function move2()
distance = transX - obj2.x
speed = 2*distance
transition.to(obj2, {time=speed, x=transX})
end

move1()
move2()[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 27415 reply_id: 111488[/import]