Transition/Easing 2.0?

Is there any information on this available somewhere? Checked the daily docs but couldn’t find anything in there.

Thanks

Edit: I’m getting this error when trying to transition the rowGroup of an old widget 1.0 tableView group (Which is like any other display group afaik) – Transition 2.0:  you have to pass a display object to a transition.from call. It worked before the daily.

EDIT:

I’m not getting any error message, but my game no longer functions correctly as of build 1207.  it seems like it might be related to transitions since my custom scene transition effects don’t do anything, but without any error messages or feedback in the console I really have no idea what’s going wrong.  

yeps, same problem here. cant submit my apps like this.

Ah okay, that´s the reason why my current project got unplayable after the update :smiley:

Guys, could you provide some example code that breaks? Normally, there shouldn’t be any problem in terms of backwards compatibility…

Also, the docs will be available shortly.

Thanks,

Alex

Hey Alex, I got the bug as soon as I tried to perform transition.from on the event.view element inside the onRender function of a tableView 1.0 widget. I’ll try get some code as soon as I get home, but I’m sure there is an easier way to reproduce it.

Right, so i just tested transition.from with our testbed and everything is ok. I really need some example that crashes…

Thanks in advance.

Alex

Ah sorry, my bad. In my case there seemed to be an error in my code, it was just that the new library threw a fatal error when transitioning a nil object - seems like the old one didn’t :slight_smile:

Thanks for the help anyway!

With the new transition 2.0, is the transitioning of nil objects not allowed? Like Skatan said, I am seeing an error when trying to transition a nil object with the new transition 2.0.

Is this the intended function?

Thank you.

I see very strange behavior using daily build 1208.   The first scene in my app will display correctly, including showing several objects that use transition.to and transition.from, but if I try to transition to a new scene using a transition.from to pull in the next scene it fails without an error.  If I remove the transition between scenes it will switch instantly to the next scene as expected but will stop rendering the new scene as soon as it encounters an object in the new scene with a transition applied to it.  If I remove transitions on objects in the new scene it will load and display correctly.  On build 1206, prior to the transition 2.0 integration, my app works perfectly with all scene and object transitions intact.

I’m not using storyboard for scene management so it is going to be difficult for me to pull out a reproducible case, especially since there’s no crash or error displayed in the console.  It just fails silently at any transition.to or .from encountered after the first scene is displayed.  So I’m not surprised if simply using the transition.from in a simple test case doesn’t exhibit the problem.  Alex, have you tried using transitions in a multi-scened project?

I should note that I set up some custom easing functions in my main.lua, such as easing.inElastic, easing.outElastic, and easing.inOutElastic, but commenting those out didn’t fix the problem.  I use a gtween.lua library that adds some transition functionality but commenting that out didn’t fix the problem.  I use crawlspaceLib.lua but commenting out that library’s transition tweaks there didn’t fix the problem.   As far as I can tell I’m not transitioning nil objects.  Not sure what else to try.

You probably should have never been able to have transitioned a nil object.   In general, it would be really helpful to Alex and team if in addition to some code that’s not working, to also post any errors showing up in your console log.

Ok, I think I can demonstrate something similar to my problem using one of the Corona sample apps.

Load up the “Storyboard” project from the Interface Samples folder.

In scene1.lua scroll down to line 54 (after “screenGroup:insert(text3)” and add this line:

transition.from(screenGroup,{ y = -200, time = 2000})  

In daily build 1206 this will cause the scene to scroll down after the scene appears.  But in daily build 1208 the scene does not scroll down.  There is no error message in the console.

It looks like the problem is that transitions used to work on display groups, but now they don’t.

EDIT:  It’s weirder than I thought.  I put that line in the same place in all 4 scenes of that sample.  In build 1206 all 4 scenes slide in from the top using that transition.  But in build 1207 none of the scenes slide in from the top the first time through.  But when the project loops back from scene 4 to scene 1 again, scene 1 does do the scroll from top.  But the next 3 scenes still don’t scroll from top.  Weird, unexpected behavior, but similar to the problems I’m seeing in my own app.

Hey HardBoiled:: try this

 timer.performWithDelay(100, function() transition.from(screenGroup,{ y = -200, time = 2000}) end, 1)

or if you are looking for a slide-in/push-out effect then something like this…

 timer.performWithDelay(100, function() screenGroup.y = -(display.contentHeight) transition.to(screenGroup,{ y = 0, time = 2000}) end, 1)

The above is just a simple test given how you said to recreate the problem, the reason for the “do once” timer is that your example uses the corona storyboard sample and it is doing some  goofy stuff to show the various workings of storyboard.

That being said, the above code does work so I am unable to reproduce the problems you guys are having but have verified that Transition 2.0 and Easing 2.0 are working good and while I really can’t see a difference on win/apple simulator or iOS i do see a major improvement on Android where I use to “sometimes” get this lag when sliding one object to the other it now works a lot more smoother on Nexus 7 and Droid X (which are my two test devices).

Just ran with the latest daily build and found a bug with transition 2.0

They don’t work with native display objects like textField.

Got the ‘Transition 2.0:  you have to pass a display object to a transition.to call.’ error.

I commented out my textField transition and my code worked again.

local t1 = native.newTextField( 10, 300, 180, 30 ) transition.from( t1, { time = 100, x = 200 } ) transition.to( t1, { time = 100, x = 200 } )

Hey Icy Spark, everyone,

Let’s get clear on “you have to pass a display object to a transition.to call”. That means you’re calling a transition on a nil object.

It was not there in Transition1.0 and thus things were error prone.

So if you run my small snippet above, it will work. If you get the error you mentioned, then you are really calling a transition on a nil object…

Alex

yeps, alexf is of course right.

In my case, i have changed a scene, tried to do a transition with a display group in the changescene method that has already been removed manually before.

now it throws an error, it didn’t before. but its better this way :slight_smile:

@dingo: It´s the same case for me, so I can fix the error by myself :slight_smile:

Yes I stand corrected.

The reason it wasn’t working for textFields for me was that I was checking if my code was running on simulator, which it was so the textField was never created.  I had only forward declared it.  

After a bunch of testing I think my own problem was caused by two separate issues:

  1.  I was incorrectly setting a transition time variable to nil within my scene transition function.  This actually works in build 1206 where transitions default to a time of 1/2 second if no time parameter is specified (or set to nil as I was erroniously doing).  For example

    local box = display.newRect(100,100,50,50) transition.to(box,{delay = 1000, time = nil, y = 400})

This simple code above will move a box down the screen over 1/2 second in build 1206.  But in build 1207 the box will snap to the final position without any transition.  The old default behavior was masking an error in my code since the time I thought I was passing was about the same length as the default.   Now, the daily docs for transition.to still says 

params.time (optional)

Number. Specifies the duration of the transition in milliseconds. By default, the duration is 500 milliseconds

 

So either the current docs are wrong if the new intention for transition 2.0 is to not  have a default transition time, or this is a bug in transitions 2.0.

 

  1.  My second, and main problem, is caused by this chunk of code that I call within my custom scene transition function to cleanup any runtime listeners in the old scene before I create the new scene:

        --cleanup any enterFrame runtime listeners in old scene     if Runtime._functionListeners.enterFrame then         for k,v in pairs(Runtime._functionListeners.enterFrame) do             Runtime:removeEventListener(“enterFrame”,v)         end     end  

In build 1206 this works; my transitions all work, and my scenes display correctly, etc.  

In build 1207 this causes the old scene to freeze on screen.  I can tell from the console that my new scene is loading, but it isn’t displaying anything. It appears that none of the transition.to or transition.from will work once this cleanup code is run.  I’m guessing that Transition 2.0 requires something that Transition 1.0 doesn’t that is getting wiped out by that code.

Admittedly, that cleanup code is a hack to solve a different problem.  I think I have another way to work around that, so hopefully I won’t need to use it anymore.

until now it all runs pretty flawless on my app.

I just had to change a little thing but now it’s fine.

I think it’s super amazing that we can just cancel, pause and resume transitions by calling the object itself in the parameter now.

that’s super awesome!