Editing the time of an existing transition

How to edit the time of an existing transition?

local square = display.newRect( 0, 0, 100, 100 ) local w,h = display.contentWidth, display.contentHeight local function listener1( obj ) print( "Transition 1 completed on object: " .. tostring( obj ) ) end local function listener2( obj ) print( "Transition 2 completed on object: " .. tostring( obj ) ) end transition.to( square, { time=1500, alpha=0, x=(w-50), y=(h-50), onComplete=listener1 } ) 

During the transition of square ,can i change the transition time in someways?

No not really.

Even if you could, that would be a total hack and not guaranteed to work later.

Sounds like you need to write your own easing code.

http://robertpenner.com/easing/

I don’t believe you can do this with the existing transition library,

Rob

During the transition of square ,can i change the transition time in someways?

recommended order:

  1. anything a transition can do, an enterFrame listener can do… better. (my pref #1)

  2. cancel the existing transition and start up a new one. (de facto pref #1)

  3. there are stated plans to open-source the transition library, you could then modify it, but still on to-do-list

∞) the hack would look like this (entirely unsupported)

local thandle = transition.to( square, { time=1500, alpha=0, x=(w-50), y=(h-50), onComplete=listener1 } ) -- halfway thru the transition make it 4 times slower timer.performWithDelay(750, function() local now = system.getTimer() local dnow = now - thandle.\_timeStart local t = dnow / thandle.\_duration thandle.\_duration = thandle.\_duration\*4 thandle.\_timeStart = now - thandle.\_duration\*t end)

No not really.

Even if you could, that would be a total hack and not guaranteed to work later.

Sounds like you need to write your own easing code.

http://robertpenner.com/easing/

I don’t believe you can do this with the existing transition library,

Rob

During the transition of square ,can i change the transition time in someways?

recommended order:

  1. anything a transition can do, an enterFrame listener can do… better. (my pref #1)

  2. cancel the existing transition and start up a new one. (de facto pref #1)

  3. there are stated plans to open-source the transition library, you could then modify it, but still on to-do-list

∞) the hack would look like this (entirely unsupported)

local thandle = transition.to( square, { time=1500, alpha=0, x=(w-50), y=(h-50), onComplete=listener1 } ) -- halfway thru the transition make it 4 times slower timer.performWithDelay(750, function() local now = system.getTimer() local dnow = now - thandle.\_timeStart local t = dnow / thandle.\_duration thandle.\_duration = thandle.\_duration\*4 thandle.\_timeStart = now - thandle.\_duration\*t end)