transition.to sometimes won't be executed

Hello,

 

maybe you can help me with an issue I have.

 

I have a function in my game which will create a display.image() and immediately start a transtion.to() . The transtion will change the alpha from 1 to 0 of the image in around 200ms.

 

 

This function is called very rapidly (often multiple times in the same step) and sometimes the transtion.to() seems to be not executed  and the images won’t fade out.

 

at the end of each transtion I call another function via onComplete which will remove the image with :removeSelf()

 

Can anyone help me?

 

Best Regards, 

 

Amplexor

Show your exact code in code blocks and we’ll try to help.

If your code is in a loop, show the loop too.

formatyourcode.jpg

To perhaps short-circuit this talk, you should be doing something like this:

for i = 1, 10 do local tmp = display.newCircle( math.random(0, 100), math.random(0, 100), 10) -- splitting these up to show simultaneous transitions on same object, -- but these could all be one transition transition.to( tmp, { x = 100 } ) transition.to( tmp, { y = 100 } ) transition.to( tmp, { alpha = 0, onComplete = display.remove } ) end

Thank you for your fast response roaminggamer,

I’ve found the problem, I was cancelling timers elsewhere in the code and I forgot about it. :wink:

But thank you for your help!

Show your exact code in code blocks and we’ll try to help.

If your code is in a loop, show the loop too.

formatyourcode.jpg

To perhaps short-circuit this talk, you should be doing something like this:

for i = 1, 10 do local tmp = display.newCircle( math.random(0, 100), math.random(0, 100), 10) -- splitting these up to show simultaneous transitions on same object, -- but these could all be one transition transition.to( tmp, { x = 100 } ) transition.to( tmp, { y = 100 } ) transition.to( tmp, { alpha = 0, onComplete = display.remove } ) end

Thank you for your fast response roaminggamer,

I’ve found the problem, I was cancelling timers elsewhere in the code and I forgot about it. :wink:

But thank you for your help!