2 Replies Latest reply on Apr 9, 2015 11:13 AM by Andres Angel

    How to Animate an element in the timeline to go to a Label?

    Andres Angel Level 1

      Hi All.

       

      I have a Horizontal timeline with ten years and I got a market under each year that I want to slide to each year when you click on it.

      Right now I have ten labels (one for each year) and a key frame fro each year. So far, i can make the element appear on each year by using sym.stop( at the label). buy how can I make the element animate or travel to each year when I click it, and not just appear ?

      So instead of the sym.play() which plays the element from the label, I want it to playTO the label. Is that possible??

       

      thanks

        • 1. Re: How to Animate an element in the timeline to go to a Label?
          Journey214 Level 1

          Hi,

           

          I think I understand what you are saying.  You want to have a symbol/timeline play from different points and stop and different points within THAT timeline?

           

          If so, could you just use a :

          sym.play("insert label here"); 
          

           

          Otherwise you could manage the timeline from the compositionReady function.  For example (after putting these into an array for each year that you have) you could create a trigger for your buttons like so:

           

          In the code below I have binded a click function (trigger) to the symbol called "placeHolder" when it "hears" a click for this it will instantiate the "if" conditional.

           

          sym.$("placeHolder").bind("click", (function(){
          if(sym.getComposition().getStage().getSymbo("symYear").getPosition) > 1000){
          sym.getSymbol("playthisanimation").play("year1800");
          }
          }
          

           

          The above code is using an if condition searching for the timeline position of "symYear" (this might be your symbol with the years animation etc.) and if the year is beyond 1000miliseconds  (one second) then it will play a certain animation called "playthisanimation" at a certain point label called "year1800".  There are many ways to get this concept to work, but it really comes down to how you tackle the issue that's the fun part!

          • 2. Re: How to Animate an element in the timeline to go to a Label?
            Andres Angel Level 1

            Thanks Journey. sym.play was playing the timeline from the label not TO the label.

            Your solution pointed me in the right way.

             

            many thanks