All very cool but have you bench-marked it yet? I had to remove transitions in my game because they were just too slow and pre-calculate everything and animate using enterFrame().
Oh and definitely add support for delta = true (I appreciate this won’t work for all transitions).
Nope, haven’t benchmarked anything yet and haven’t paid any attention to optimization either. Feel free to do it.
I agree that transitions tend be too slow if you have many objects moving in your game, and just like you I don’t use transitions for everything in my game because of that. But I also think there are many occasions where you only need to animate a few objects and don’t really care that much about performance.
delta = true should already be implemented. Doesn’t it work for you?
EDIT: Sorry, was a bit quick on the delta thing. It’s been implemented for to() and from(), but not for the other functions. Will review them to see where it makes sense to add delta support. Thanks.
I made a small adjustment to zRotate which I think would be beneficial to add to the library. I wanted to be able to rotate an object 180 degrees, and then at some later point rotate back from 180 to 0 degrees. However the zRotate function always starts the rotation at 0. So I changed:
getStartValue = function(target, params) return 0 end
to this:
getStartValue = function(target, params) return params.startDegrees or 0 end
This way I can pass in an extra parameter specifying the rotation to start at, as well as the rotation to transition towards:
I realise that the transition already has a “reverse” parameter, but afaik that can only be triggered automatically after the initial rotation whereas by using the startDegrees param I can trigger it whenever I want.
Thanks a lot for your input! I’ve implemented your suggested param startDegrees in transition2 now, but with some modifications.
What I’ve done is:
Always save the current “zRotation” degrees on the target object being rotated, to be able to access it through target.zRotation just as with any other display object params.
params.degrees will always be considered a delta value instead of an absolute value. If the object being rotated already has a zRotation value, the rotation will start from that angle. If not, it will default to start rotating from a 0 value, just like it was hard-coded before.
The param startDegrees can be used to override the saved zRotation value.
So in your case, it should be possible to get the same result by skipping startDegrees completely and instead reversing the value of params.degrees to -180 when rotating back.
Like this:
transition.zRotate(myObj, { degrees = 180, iterations = 1, time = 1000, transition = easing.inOutSine, reverse = false, }) -- Some time later... transition.zRotate(myObj, { degrees = -180, iterations = 1, time = 1000, transition = easing.inOutSine, reverse = false, })
Just let me know if you see any problems with this and I’ll do my best to find another solution.
Hi Markus, I am currently getting this error when using your transition library:
Module 'transition2lib.transition2-main' not found: no field package.preload['transition2lib.transition2-main'] no file '/Users/0278046/Library/Application Support/Corona/Simulator/Plugins/transition2lib/transition2-main.lua' no file '/Users/0278046/Desktop/Corona SDK/Corona Projects/Space Shooter/transition2lib/transition2-main.lua' no file '/Users/0278046/Desktop/Corona SDK/Corona Simulator.app/Contents/Resources/transition2lib/transition2-main.lua' no file './transition2lib/transition2-main.lua' no file './transition2lib/transition2lib/transition2-main.lua' no file '/Users/0278046/Library/Application Support/Corona/Simulator/Plugins/transition2lib/transition2-main.dylib' no file './transition2lib/transition2-main.dylib' no file '/Users/0278046/Desktop/Corona SDK/Corona Simulator.app/Contents/Resources/transition2lib/transition2-main.dylib' no file '/Users/0278046/Library/Application Support/Corona/Simulator/Plugins/transition2lib.dylib' no file './transition2lib.dylib' no file '/Users/0278046/Dmodule 'transition2lib.transition2-main' not found
And the stack traceback points to this line:
local createTransition2 = require("transition2lib.transition2-main")
Wow, just stumbled upon your library and it looks amazing. Thank you very much for not only putting all your efforts in, but also sharing it here. Will definitely remember transition2 the next time I consider transitioning an object
I ran into an issue while testing a few of the cool transitions you have, it might be just how it works or it might be an issue.
When trying the waterBalloon transition I notice that if I start the transition at a point after the scene has started, it flickers just before it starts. Looking into the code I think I see why, the start value yScale is not equal to the original yScale