Mirror object if transition event.x > object.x

Is there a way to mirror an object ( object:scale(-1, 1) like so) while using a transition.to() event if transition event.x > object.x?

Here is my code:

 local function flip( event ) if tween1.parmas.x \> angry.x then angry:scale(-1, 1); -- Mirror elseif tween1.x \< angry.x or tween2.x == angry.x then angry:scale(1, 1); -- Mirror end end local function flip2( event ) if tween2.x \> angry.x then angry:scale(-1, 1); -- Mirror elseif tween2.x \< angry.x or tween2.x == angry.x then angry:scale(1, 1); -- Mirror end end local function moveAngry() local tween1 = transition.to(angry, {time=1250, delay = 1, x=math.random(20,440), y=math.random(20,270), onStart = flip, onComplete=moveAngry}) local tween2 = transition.to(angry2, {time=1250, delay = 1, x=math.random(20,440), y=math.random(20,270), onStart = flip2 }) end moveAngry()

This will make it some my object, angry, will flip if the transition event.x is less than the current x position. If this can not be done, does anyone have a work around?

Thanks 
Sam

Look for pausable transitions in code exchange. It offers an onEnterFrame method. In it’s listener check for your condition and do whatever you want to do with the object. 

or you could just start a timer.performWithDelay loop with onStart of your transition, which you cancel with onComplete of your transition. in that loop you put your flip function.

that would essentially be the same as what ktdevworks suggestion would do, just without a custom transition class.
but actually nothing speaks against using one, they have many benefits, like the one kt mentioned and for example more easing types and so on.

Look for pausable transitions in code exchange. It offers an onEnterFrame method. In it’s listener check for your condition and do whatever you want to do with the object. 

or you could just start a timer.performWithDelay loop with onStart of your transition, which you cancel with onComplete of your transition. in that loop you put your flip function.

that would essentially be the same as what ktdevworks suggestion would do, just without a custom transition class.
but actually nothing speaks against using one, they have many benefits, like the one kt mentioned and for example more easing types and so on.