0 Replies Latest reply on Mar 13, 2014 7:29 AM by enixon-shapiro

    Parallax in an if statement

    enixon-shapiro

      Hi All,

       

      I'm currently trying to do a parallax like effect in a small spot in my animation. I am trying to put it in an if...else statement so the parallax effect only runs within the time that I want it to, and doesn't overtake the rest of my animation.

       

      Here's what I have so far:

       

      in creation complete:

       

      if (sym.getPosition() > 34000){

          this.onMove=function(posX, posY){

              timelinecontrol = Number(posY)*10+34000;

              console.log(timelinecontrol);

              sym.stop(timelinecontrol);

          }

      }

      else{

      sym.play();

      }

       

      I tried using // to get rid of the if, else part and just ran the parallax without any constraints and the parallax effect ran just fine, only it completely overtook the rest of my animation so I could only see that part.

       

      Should I keep trying to use the "if" statement? Is this the right way to go? How do I get it to work properly? How, also, do I get the if statement to go between two numbers i.e. sym.getPosition() > 34000 & < 44000

       

      Should I maybe try a while statement? How would I go about coding that?

       

      Thanks in advance for any help! I'm a novice at coding, so this has been a bit of a headache for me.