Serious problem with transition api in 2013.2100

Please can someone confirm this for me. I have already filed a bug report (case 28926).

Description:

if I supply a transition function in a call to transition.to it is not called on the final end value as it was before. Observed on windows simulator and android device. Not tested on other platforms.

Steps to reproduce:

Just call a transition.to with a short time on any object and supply a transition function. Now put a breakpoint in the transition function and it will be called once but when you resume from the breakpoint and the time for transition has already elapsed it will not get called again on the end value as it did before. This leaves objects hanging in the middle of the transition and requires you to supply a onComplete function to finalize everything you are doing in the transition function. instead of a breakpoint you can try doing something CPU intensive during the transition and it will have the same effect.

Sample code:

local rect = display.newRect(0, 0, 100, 100) rect:setFillColor(1, 1, 1, 1) rect.x = display.contentCenterX - 100 rect.y = 50 local rect1 = display.newRect(0, 0, 100, 100) rect1:setFillColor(1, 1, 1, 1) rect1.x = display.contentCenterX + 100 rect1.y = 50 local function transitionF(t, tMax, start, delta) local cy = start + delta \* t / tMax rect1.y = cy -- put breakpoint here return cy end transition.to(rect, {time = 200, y = 300, transition = transitionF})

Hi there.

2 problems with your code (assuming that you want to have the transitionF run when the transition ends):

  1. You are using “transition = transitionF” but should be using “onComplete = transitionF”  

  2. You are assuming that the transitionF receives the params (t, tMax, start, delta) what is not true.

I want it to run every frame of the transition. That is what transition parameter does providing you the ability to customize transitions and it’s supposed to run for the final time aswell as it did before but now it doesn’t. It runs all the frames before without problems.

From the docs:

params.transition (optional)

Function. Specifies the easing interpolation method. Default is linear.

As far as I know, the transition must be an easing interpolation method, like transition = easing.inExpo  or transition = easing.liner. 

I don’t know if it is possible to customize it, and even it it, I don’t have experience with that, so I am afraid I cannot help you.

But what I understand from your code, is that you want to make the rect1 follows the rect, in which is being moved by a transition. I am pretty sure that you can do that without messing up with the transition params.

And your function transitionF is being called just because it is there as one of the params, you could use it as xyz = transitionF in the table that it would be continue to be calling.

I am sorry but you don’t understand the situation. The code is a minimized example showing the wrong behaviour it’s not from an app.

As you can see from the docs the transition option is a function as are easing.* functions provided by corona, but you can provide your own function. xyz = transitionF will not be called because there are no brackets meaning you are passing a function reference not calling the function.

Yes, I missed the () in the end.

As I said before, I don’t have experience in customizing transition easing functions.

You’re right. This must be a bug.

if you add **print(t,tMax,start,delta) **inside your function, you’ll see that it’s never called for the last iteration “200”.

2013-12-14 15:31:38.651 Corona Simulator[19283:507] 0.066000000000003   200 50  250
2013-12-14 15:31:38.667 Corona Simulator[19283:507] 15.884  200 50  250
2013-12-14 15:31:38.686 Corona Simulator[19283:507] 34.942  200 50  250
2013-12-14 15:31:38.713 Corona Simulator[19283:507] 62.658  200 50  250
2013-12-14 15:31:38.727 Corona Simulator[19283:507] 76.281  200 50  250
2013-12-14 15:31:38.743 Corona Simulator[19283:507] 92.605  200 50  250
2013-12-14 15:31:38.759 Corona Simulator[19283:507] 108.819 200 50  250
2013-12-14 15:31:38.776 Corona Simulator[19283:507] 125.142 200 50  250
2013-12-14 15:31:38.792 Corona Simulator[19283:507] 141.021 200 50  250
2013-12-14 15:31:38.808 Corona Simulator[19283:507] 157.038 200 50  250
2013-12-14 15:31:38.824 Corona Simulator[19283:507] 172.871 200 50  250
2013-12-14 15:31:38.839 Corona Simulator[19283:507] 188.705 200 50  250

The last G1 release (2013.1260) behaves properly:

2013-12-14 15:30:02.879 Corona Simulator[19236:507] 0.023   200 50  250
2013-12-14 15:30:03.002 Corona Simulator[19236:507] 122.897 200 50  250
2013-12-14 15:30:03.038 Corona Simulator[19236:507] 158.916 200 50  250
2013-12-14 15:30:03.041 Corona Simulator[19236:507] 161.249 200 50  250
2013-12-14 15:30:03.056 Corona Simulator[19236:507] 176.229 200 50  250
2013-12-14 15:30:03.071 Corona Simulator[19236:507] 192.042 200 50  250
2013-12-14 15:30:03.088 Corona Simulator[19236:507] 200 200 50  250

Thanks for the confirmation, The last public release 2013.2076 was still good.

You’re right!  2013.2076 is OK.

So something happened between the last public release and this one.

build 2076:

2013-12-15 00:41:32.357 Corona Simulator[22524:507] 0.055000000000007   200 50  250
2013-12-15 00:41:32.375 Corona Simulator[22524:507] 18.055  200 50  250
2013-12-15 00:41:32.393 Corona Simulator[22524:507] 35.755  200 50  250
2013-12-15 00:41:32.418 Corona Simulator[22524:507] 60.578  200 50  250
2013-12-15 00:41:32.427 Corona Simulator[22524:507] 69.281  200 50  250
2013-12-15 00:41:32.443 Corona Simulator[22524:507] 85.763  200 50  250
2013-12-15 00:41:32.459 Corona Simulator[22524:507] 101.266 200 50  250
2013-12-15 00:41:32.475 Corona Simulator[22524:507] 117.694 200 50  250
2013-12-15 00:41:32.490 Corona Simulator[22524:507] 133.117 200 50  250
2013-12-15 00:41:32.507 Corona Simulator[22524:507] 149.407 200 50  250
2013-12-15 00:41:32.523 Corona Simulator[22524:507] 165.212 200 50  250
2013-12-15 00:41:32.538 Corona Simulator[22524:507] 181.148 200 50  250
2013-12-15 00:41:32.554 Corona Simulator[22524:507] 197.111 200 50  250
2013-12-15 00:41:32.571 Corona Simulator[22524:507] 200 200 50  250

I think it’s best if you could file a bug report with your code above.

(You can add a print(t,tMax,start,delta) at the beginning of your transitionF function to display the problem)

Have already done so. Though without the print but I think it demonstrates the problem suficiently.

Any thoughts from the staff on this?

Hi @primoz.cerar,

We are investigating this along with the other transition issue reported by users last week. Thanks for the detailed report.

Brent

Glad to know that.

You’re welcome. I know tracking down bugs without a detailed report is a pain.

Hi there.

2 problems with your code (assuming that you want to have the transitionF run when the transition ends):

  1. You are using “transition = transitionF” but should be using “onComplete = transitionF”  

  2. You are assuming that the transitionF receives the params (t, tMax, start, delta) what is not true.

I want it to run every frame of the transition. That is what transition parameter does providing you the ability to customize transitions and it’s supposed to run for the final time aswell as it did before but now it doesn’t. It runs all the frames before without problems.

From the docs:

params.transition (optional)

Function. Specifies the easing interpolation method. Default is linear.

As far as I know, the transition must be an easing interpolation method, like transition = easing.inExpo  or transition = easing.liner. 

I don’t know if it is possible to customize it, and even it it, I don’t have experience with that, so I am afraid I cannot help you.

But what I understand from your code, is that you want to make the rect1 follows the rect, in which is being moved by a transition. I am pretty sure that you can do that without messing up with the transition params.

And your function transitionF is being called just because it is there as one of the params, you could use it as xyz = transitionF in the table that it would be continue to be calling.

I am sorry but you don’t understand the situation. The code is a minimized example showing the wrong behaviour it’s not from an app.

As you can see from the docs the transition option is a function as are easing.* functions provided by corona, but you can provide your own function. xyz = transitionF will not be called because there are no brackets meaning you are passing a function reference not calling the function.

Yes, I missed the () in the end.

As I said before, I don’t have experience in customizing transition easing functions.

You’re right. This must be a bug.

if you add **print(t,tMax,start,delta) **inside your function, you’ll see that it’s never called for the last iteration “200”.

2013-12-14 15:31:38.651 Corona Simulator[19283:507] 0.066000000000003   200 50  250
2013-12-14 15:31:38.667 Corona Simulator[19283:507] 15.884  200 50  250
2013-12-14 15:31:38.686 Corona Simulator[19283:507] 34.942  200 50  250
2013-12-14 15:31:38.713 Corona Simulator[19283:507] 62.658  200 50  250
2013-12-14 15:31:38.727 Corona Simulator[19283:507] 76.281  200 50  250
2013-12-14 15:31:38.743 Corona Simulator[19283:507] 92.605  200 50  250
2013-12-14 15:31:38.759 Corona Simulator[19283:507] 108.819 200 50  250
2013-12-14 15:31:38.776 Corona Simulator[19283:507] 125.142 200 50  250
2013-12-14 15:31:38.792 Corona Simulator[19283:507] 141.021 200 50  250
2013-12-14 15:31:38.808 Corona Simulator[19283:507] 157.038 200 50  250
2013-12-14 15:31:38.824 Corona Simulator[19283:507] 172.871 200 50  250
2013-12-14 15:31:38.839 Corona Simulator[19283:507] 188.705 200 50  250

The last G1 release (2013.1260) behaves properly:

2013-12-14 15:30:02.879 Corona Simulator[19236:507] 0.023   200 50  250
2013-12-14 15:30:03.002 Corona Simulator[19236:507] 122.897 200 50  250
2013-12-14 15:30:03.038 Corona Simulator[19236:507] 158.916 200 50  250
2013-12-14 15:30:03.041 Corona Simulator[19236:507] 161.249 200 50  250
2013-12-14 15:30:03.056 Corona Simulator[19236:507] 176.229 200 50  250
2013-12-14 15:30:03.071 Corona Simulator[19236:507] 192.042 200 50  250
2013-12-14 15:30:03.088 Corona Simulator[19236:507] 200 200 50  250

Thanks for the confirmation, The last public release 2013.2076 was still good.