A Fuse Powered Company

Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Transition/Easing 2.0?
Started by Skatan Sep 18 2013 04:44 AM

67 replies to this topic
[TOPIC CONTROLS]
Page 1 of 3 1 2 3
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Skatan

[GLOBAL: userInfoPane.html]
Skatan
  • Pro
  • PipPipPipPipPipPip
  • 535 posts
  • Jedi

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.



[TOPIC: post.html]
#2

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Pro
  • PipPipPipPipPipPip
  • 711 posts
  • Jedi

+ 1 

 

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.  



[TOPIC: post.html]
#3

dingo

[GLOBAL: userInfoPane.html]
dingo
  • Enterprise
  • PipPipPipPipPipPip
  • 683 posts
  • Jedi

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



[TOPIC: post.html]
#4

CineTek

[GLOBAL: userInfoPane.html]
CineTek
  • Starter
  • PipPipPipPipPipPip
  • 310 posts
  • Jedi

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



[TOPIC: post.html]
#5

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Corona Staff
  • 238 posts
  • Jedi

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



[TOPIC: post.html]
#6

Skatan

[GLOBAL: userInfoPane.html]
Skatan
  • Pro
  • PipPipPipPipPipPip
  • 535 posts
  • Jedi

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.

[TOPIC: post.html]
#7

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Corona Staff
  • 238 posts
  • Jedi

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



[TOPIC: post.html]
#8

Skatan

[GLOBAL: userInfoPane.html]
Skatan
  • Pro
  • PipPipPipPipPipPip
  • 535 posts
  • Jedi

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 :-)

 

Thanks for the help anyway!



[TOPIC: post.html]
#9

macman223

[GLOBAL: userInfoPane.html]
macman223
  • Pro
  • PipPipPipPipPipPip
  • 100 posts
  • Jedi

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.



[TOPIC: post.html]
#10

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Pro
  • PipPipPipPipPipPip
  • 711 posts
  • Jedi

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.



[TOPIC: post.html]
#11

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 10,737 posts
  • Jedi

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.



[TOPIC: post.html]
#12

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Pro
  • PipPipPipPipPipPip
  • 711 posts
  • Jedi

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.



[TOPIC: post.html]
#13

Christopher Bishop

[GLOBAL: userInfoPane.html]
Christopher Bishop
  • Pro
  • PipPipPipPipPipPip
  • 365 posts
  • Jedi

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).



[TOPIC: post.html]
#14

Icy Spark

[GLOBAL: userInfoPane.html]
Icy Spark
  • Pro
  • PipPipPipPipPipPip
  • 243 posts
  • Jedi

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.



[TOPIC: post.html]
#15

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Corona Staff
  • 238 posts
  • Jedi

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



[TOPIC: post.html]
#16

dingo

[GLOBAL: userInfoPane.html]
dingo
  • Enterprise
  • PipPipPipPipPipPip
  • 683 posts
  • Jedi

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 :)



[TOPIC: post.html]
#17

CineTek

[GLOBAL: userInfoPane.html]
CineTek
  • Starter
  • PipPipPipPipPipPip
  • 310 posts
  • Jedi

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



[TOPIC: post.html]
#18

Icy Spark

[GLOBAL: userInfoPane.html]
Icy Spark
  • Pro
  • PipPipPipPipPipPip
  • 243 posts
  • Jedi

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

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.  



[TOPIC: post.html]
#19

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Pro
  • PipPipPipPipPipPip
  • 711 posts
  • Jedi

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.

 

2.  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.



[TOPIC: post.html]
#20

searchm

[GLOBAL: userInfoPane.html]
searchm
  • Pro
  • PipPipPipPipPipPip
  • 187 posts
  • Jedi

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!



[TOPIC: post.html]
#21

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Enterprise
  • PipPipPipPipPipPip
  • 2,443 posts
  • Jedi

Pausable transitions! Woohoo! Yes!!

Gotta' replace my proprietary code now :-)



[TOPIC: post.html]
#22

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Corona Staff
  • 238 posts
  • Jedi

Guys, if you have any ideas for improvement, feedback, other functionality you want to see in future versions of Transition, please don't hesitate to write them in a thread or in the feedback tool. The current version has been built on user feedback as well, and we would like to keep that going.

 

There's gonna be a minor update soon, that sets the transition time to 500msec if no time provided (was the behaviour of T1.0), brings back the convenience method transition.dissolve, and some other improvements.

 

@HardBoiledIndustries: using a runtime listener removal loop on the Runtime object is really a bad idea, a lot of third-party libraries and some of ours make use of global runtime listeners (enterFrame), i can only recommend to store your created listeners in a table / global object (maybe even the storyboard object itself) and just clean those up...

 

alex



[TOPIC: post.html]
#23

Christopher Bishop

[GLOBAL: userInfoPane.html]
Christopher Bishop
  • Pro
  • PipPipPipPipPipPip
  • 365 posts
  • Jedi

Here ya go :)

http://forums.coronalabs.com/topic/39596-transition-20-easing-20-request/

 

All in all pretty happy with transitions (and the new easing) so just requesting some kind of distort feature.so i could distort the top and bottom widths of an image. :)



[TOPIC: post.html]
#24

Dotnaught

[GLOBAL: userInfoPane.html]
Dotnaught
  • Pro
  • PipPipPipPipPipPip
  • 344 posts
  • Jedi

A selector menu in my app broke with 2013.1210:

 

Transition 2.0:  you have to pass a display object to a transition.to call.
stack traceback:
    [C]: ?
    [C]: in function 'error'
    ?: in function 'to'
    ...ents/Code/gitstuff/Dawnrazor/views/LevelSelector.lua:91: in function 'cancelMove'
 
As far as I can tell, I am passing a display object. It's not triggering the print statement.
 

function cancelMove()
    if not thumbs[thumbNum-1] then
        print  ("It's nil")
    end
    tween = transition.to( thumbs[thumbNum], {time=400, x=screenW*.5, transition=easing.outExpo } )
    tween = transition.to( thumbs[thumbNum-1], {time=400, x=(screenW*.5 + padding)*-1, transition=easing.outExpo } ) -- this is line 91
    tween = transition.to( thumbs[thumbNum+1], {time=400, x=screenW*1.5+padding, transition=easing.outExpo } )
end
 

 
Any ideas?


[TOPIC: post.html]
#25

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Pro
  • PipPipPipPipPipPip
  • 711 posts
  • Jedi

@Dotnaught,

 

You're only checking for the existence of thumbs[thumbNum-1], but you're doing transitions for thumbs[thumbNum] and thumbs[thumbNum+1] so maybe one of those is missing and causing your error.

 

@HardBoiledIndustries: using a runtime listener removal loop on the Runtime object is really a bad idea, a lot of third-party libraries and some of ours make use of global runtime listeners (enterFrame), i can only recommend to store your created listeners in a table / global object (maybe even the storyboard object itself) and just clean those up...
Yeah, I know it's a nasty hack, but up until Transitions 2.0 it worked without issue so I left it in.  I did figure out out a way to do without it now, so the new transitions forced me to clean up my code for the better.



[topic_controls]
Page 1 of 3 1 2 3
 
[/topic_controls]