Going from Scene A to Scene A with slideLeft effect

OK, imagine you are on a scene called scene A.

  1. You press a button
  2. Using the “slideLeft” effect, you transition from scene A to scene A again, only with slightly different content (like showing different photos, etc.). But it is the same scene and source file.
  3. Repeat 1-2

However, when I do storyboard.gotoScene(currentScene), Corona simply stays at the current scene. The only ways I could think to achieve the desired effect are not satisfactory:

  • Creating an “b.lua” file that has exactly the same source code as “a.lua”, and then alternate between the two each time I want to change scene. Effective, but a stupid hack.
  • Use the transition class to manually slide out the current display group, and create a new display group with new content. Lots of work.

What is the easiest way to achieve what I’m trying for?

PS! Actually, I would prefer if the API was changed so that gotoScene from A to A would go to the same scene with a transition effect. (Programmers who want to avoid this would have to check if they are transitioning to the same scene and then skip the gotoScene).

Hi @olavm.  I’m encountering the same issue in an app I’m building.  Mine is a photo gallery app and the original version (before we could reload the current scene) I ended up with a lua file for each image so that I could swipe them in.   I’m re-doing things and I’m using the page01, page02 solution.  

Storyboard isn’t designed for what you are trying to do.  Scenes have one display group.  The transitions work by loading the 2nd scene, creating it’s group offscreen/behind the current scene, then using two separate groups manage the transitions.  When you only use one scene, you only have one display group which is already displaying, you can’t transition it.

Storyboard is great when you have multiple scenes (a  menu, a game level, help, credits, etc.), but it may not be the right way to deal with photo slide shoes.  A scrollView where you have three images loaded at once (left of screen, on screen, right of screen) and as the scrollView moves, you can shuffle the left of/right of screen images in and out as necessary.

@Rob: Thanks for your well-written clarification. I realize now I will have to use transitions. Is there a transition effect that mimics “slideLeft”?

(On a side note, are there plans of adding more transitions to the easing library? The selection seems to be quite poor compared to what is possible on native devices. As a last resort, are there any third party libraries you can recommend for great transition effects?)

See “Scene Effects” on this page:

http://docs.coronalabs.com/api/library/storyboard/gotoScene.html

No, I meant the easing library, which only lists the following effects (much fewer than the scene effects):

  • easing.inExpo()
  • easing.inOutExpo()
  • easing.inOutQuad()
  • easing.inQuad()
  • easing.linear()
  • easing.outExpo()
  • easing.outQuad()

Since I can’t use scene transitions for the thing I’m making, I assume I have to use easing on the scene display group instead.

So, is there any way I can use more easing effects than the ones listed above? (Third party libraries, undocumented effects, etc.?)

Olavm, check, http://developer.coronalabs.com/code/more-easing

Just don’t name the library easing.lua. See 3rd bottom comment.

Don’t confuse easings with transitions.  A transition is simply moving/changing one thing to another.  “slideLeft” is a transition that moves the screen from right to left.   Easings are “How” that transition happen.  Without an easing, the default is “linear”, meaning that if you’re moving something from right to left across the full screen, the linear easing simply moves each X pixel equally over time.   When you put easings into play, that movement happens at different rates, like start slowly then speed up at the end or start fast then slow down. 

Storyboard supports a bunch of transitions, but the easings are limited. 

Hi @olavm.  I’m encountering the same issue in an app I’m building.  Mine is a photo gallery app and the original version (before we could reload the current scene) I ended up with a lua file for each image so that I could swipe them in.   I’m re-doing things and I’m using the page01, page02 solution.  

Storyboard isn’t designed for what you are trying to do.  Scenes have one display group.  The transitions work by loading the 2nd scene, creating it’s group offscreen/behind the current scene, then using two separate groups manage the transitions.  When you only use one scene, you only have one display group which is already displaying, you can’t transition it.

Storyboard is great when you have multiple scenes (a  menu, a game level, help, credits, etc.), but it may not be the right way to deal with photo slide shoes.  A scrollView where you have three images loaded at once (left of screen, on screen, right of screen) and as the scrollView moves, you can shuffle the left of/right of screen images in and out as necessary.

@Rob: Thanks for your well-written clarification. I realize now I will have to use transitions. Is there a transition effect that mimics “slideLeft”?

(On a side note, are there plans of adding more transitions to the easing library? The selection seems to be quite poor compared to what is possible on native devices. As a last resort, are there any third party libraries you can recommend for great transition effects?)

See “Scene Effects” on this page:

http://docs.coronalabs.com/api/library/storyboard/gotoScene.html

No, I meant the easing library, which only lists the following effects (much fewer than the scene effects):

  • easing.inExpo()
  • easing.inOutExpo()
  • easing.inOutQuad()
  • easing.inQuad()
  • easing.linear()
  • easing.outExpo()
  • easing.outQuad()

Since I can’t use scene transitions for the thing I’m making, I assume I have to use easing on the scene display group instead.

So, is there any way I can use more easing effects than the ones listed above? (Third party libraries, undocumented effects, etc.?)

Olavm, check, http://developer.coronalabs.com/code/more-easing

Just don’t name the library easing.lua. See 3rd bottom comment.

Don’t confuse easings with transitions.  A transition is simply moving/changing one thing to another.  “slideLeft” is a transition that moves the screen from right to left.   Easings are “How” that transition happen.  Without an easing, the default is “linear”, meaning that if you’re moving something from right to left across the full screen, the linear easing simply moves each X pixel equally over time.   When you put easings into play, that movement happens at different rates, like start slowly then speed up at the end or start fast then slow down. 

Storyboard supports a bunch of transitions, but the easings are limited.