Animation depending on List

How to make animation depending on List option?

  1. Create a List global (e.g. list) and make the values 1 and 2 for now.
  2. Create an Overlay Group on your base or top level in you project.
  3. In the overlap group create a shape or object that you want to animate.
  4. In the overlap group you will see an Animation tab (to the right of position).
  5. Press the + at top right of screen and create a new animation. In the center of the row, to the right of where it says Disabled, click and select React on Formula from the drop down.
  6. Where it says Formula enter:
    $if(gv(list)=1,1,0)$
  7. This means that if your global ‘list’ is equal to 1 then (1) perform the action, and if ‘list’ does not equal 1 then do nothing (0). The last two values ,1,0)$ could also be entered as ,f,b)$ so 1 matches f to go forward, and 0 matches b to go back, or do nothing.
  8. Pick the Action you want, such as Scale Out Vertical.
  9. Select Ease > Inverted which will make your object appear on the screen. Pressing the little video Play icon at the top should show your selected animation.
  10. Create another Animation but this time the formula should be $if(gv(list)!=1,1,0)$ where the != means 'not equal to". Also set the Ease to Normal which will make the object disappear when gv(list) isn’t 1.
  11. Now you need a switch or trigger to cycle the list variable. There are lots of ways to do this. For example select or put an item on your screen and in the Touch tab at far right add (+) an action. Select Toggle Global Switch and then select your ‘list’ variable. Lastly for the Enter field select Next Value.

Now when you save it and go to to your interface pressing your trigger should make your object scale in or out whenever you touch it.

You could add more values to your list variable for other choices, and selecting Complex Animation instead of Scale Out Vertical (or other simple actions) will let you create complicated movements around the screen with fades and other effects but you’ll want to do more research, practice and work up to those slowly.

2 Likes

Thanks, I figured it out meanwhile. What I did is $if(gv(list)=0,1, gv(list)=1,1, gv(list)=2,1, gv(list)=3,1,0)$