make transition stop (on tap)

Hey,

I have simple a transition that makes an object to move over a certain time period.

I’d like the transition to complete immediately (before preset time) on a certain event (a tap i.e.).

How should I treat the time value inside the transition table to make it react to the event?

Hope I have been clearer than it feels.

Thanks!

Hello @akak,

For this, you should cancel the transition entirely, then you should just set the object to its final position/scale/alpha or whatever is your “final state” for the transition.

http://docs.coronalabs.com/api/library/transition/cancel.html

Take care,

Brent

thank you very  much!!

you confirm there’s no other way to diminish the transition time variable on event, or ‘fasten’ the transition on tap to say it in other words???

Hi @akak,

Once the transition starts, you can’t change the time “mid transition”. Although, I suppose you could set a property on the transition for the system time when it started, then on cancel, compare that time with the start time to figure out how much time has elapsed. Then, you could use that difference to start a new transition. Not sure if that’s what you’re implying though…

Brent

got it. i guess you’re saying to ‘stopandgo’ the transition by canceling the initial one and perform another one that would start were the first one was suspended. sorta?

Anyway the solution you proposed first works fine codewise and the result is visually acceptable (pretty cool actually).

Thanks alot for the quick answer!!!

Hello @akak,

For this, you should cancel the transition entirely, then you should just set the object to its final position/scale/alpha or whatever is your “final state” for the transition.

http://docs.coronalabs.com/api/library/transition/cancel.html

Take care,

Brent

thank you very  much!!

you confirm there’s no other way to diminish the transition time variable on event, or ‘fasten’ the transition on tap to say it in other words???

Hi @akak,

Once the transition starts, you can’t change the time “mid transition”. Although, I suppose you could set a property on the transition for the system time when it started, then on cancel, compare that time with the start time to figure out how much time has elapsed. Then, you could use that difference to start a new transition. Not sure if that’s what you’re implying though…

Brent

got it. i guess you’re saying to ‘stopandgo’ the transition by canceling the initial one and perform another one that would start were the first one was suspended. sorta?

Anyway the solution you proposed first works fine codewise and the result is visually acceptable (pretty cool actually).

Thanks alot for the quick answer!!!