Change transition time after declaration

local options = {         x = 200,         time = 3000,         iterations = 0, onRepeat = function() print("something") end }    local transition = transition.to( obj, options ) 

Is it possible to change the “time” property after the declaration?

no you would need to kill the transition and recreate it

Or, you could use Marcus Ranners new Transition module which allows you to alter parameters between iterations.

See this thread.

Thanks for the reply guys. I guess I will have to use the “enterFrame” event to do what I want instead of transition. 

Edit: managed to do it, by using “onComplete” and calling the same function that holds the transition. But, it would have been much easier if we were able to change properties after the declaration.

Is it possible to change the “time” property after the declaration?

Yes, it’s possible.

You can get the duration property of the transition with the “_duration” key.

So :

local tr local options options = {x = 200, time = 3000, iterations = 0, onRepeat = function() print("duration is "..tr.\_duration) tr.\_duration=tr.\_duration-300 if tr.\_duration\<0 then transition.cancel(tr) ; options =nil ; return end options.time=tr.\_duration print("duration is more quick and is now :"..tr.\_duration) end} tr=transition.to( obj, options )

You can also change it after, on a timer for example.

enterFrame() is always preferable to repeated transitions; after all transition is just a convenience wrapper for enterFrame()

Where is this “_duration” property coming from? I can’t see it in the docs.

It’s not on the docs  B) lol

In fact I explore the table " transition " with pprint (or print_r) function and you will find what’s inside.

It’s the same with " timer " table.

And then you try to changes this value to see if there are no problems for the operation of the transition…

The reason it is not documented is you are not supposed to be changing internal “private” variables.  Do so at your own risk obviously!

no you would need to kill the transition and recreate it

Or, you could use Marcus Ranners new Transition module which allows you to alter parameters between iterations.

See this thread.

Thanks for the reply guys. I guess I will have to use the “enterFrame” event to do what I want instead of transition. 

Edit: managed to do it, by using “onComplete” and calling the same function that holds the transition. But, it would have been much easier if we were able to change properties after the declaration.

Is it possible to change the “time” property after the declaration?

Yes, it’s possible.

You can get the duration property of the transition with the “_duration” key.

So :

local tr local options options = {x = 200, time = 3000, iterations = 0, onRepeat = function() print("duration is "..tr.\_duration) tr.\_duration=tr.\_duration-300 if tr.\_duration\<0 then transition.cancel(tr) ; options =nil ; return end options.time=tr.\_duration print("duration is more quick and is now :"..tr.\_duration) end} tr=transition.to( obj, options )

You can also change it after, on a timer for example.

enterFrame() is always preferable to repeated transitions; after all transition is just a convenience wrapper for enterFrame()

Where is this “_duration” property coming from? I can’t see it in the docs.

It’s not on the docs  B) lol

In fact I explore the table " transition " with pprint (or print_r) function and you will find what’s inside.

It’s the same with " timer " table.

And then you try to changes this value to see if there are no problems for the operation of the transition…

The reason it is not documented is you are not supposed to be changing internal “private” variables.  Do so at your own risk obviously!