7 Replies Latest reply on Feb 4, 2015 1:01 PM by resdesign

    VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation

    NEW EXPORT ACCOUNT

      Hi,

       

      I am honestly pretty surprised that there isn't an obvious way to do this in the code panel. Simply would like to make an onclick function that plays from a certain frame to another frame. The function would know to play forward or reverse.

       

      This is primarily to enable making common modern scrollTo() style animation so I can click a button on a menubar and have the page scroll to the corresponding part of the page I would like to see. Using an if statement with getPosition doesn't seem to do this properly because using stop points on the timeline would make it so that, if there are more than 2 buttons, the stop points would be in the way.

       

      So, an "if position==Label1, play forward to Label3" doesn't work properly if there is a stop point at Label 2. This is a very common and basic JQuery effect, seen in slide shows and so on. Say a slide show has 4 slides and 4 circles below it for navigation...the slides slide when the buttons are clicked.

       

      Surprised this has seemingly been overlooked.

       

      Thanks in advance for posting a way to do so!

        • 1. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
          T. Ganoe Level 1

          I wrote a timeout/ interval  function where you can pass the symbol, the start time and end time and it will keep calling itself and advancing the timeline until it reaches the end time.  It's only 12 lines. 

           

          function timerFunction(startms,  targetms, addinc, asymbol) {

                //startms is the timeline starting point, usually where it is at the beginningof all this

                //targetms is the desired timeline position

               //addinc is the milliseconds you want the settimeout to wait, I use 500

               // asymbol is the function with the timeline you want to control.  Note: it is being passed around here be reference, not copies which is good.

              //so call it like this:  timerFunction(freqsym.getPosition(), 1800, 100, freqsym)

                 var ms;

                //console.log(" startms: " + startms + ", targetms: " + targetms +", addinc: " + addinc );

           

              if ( addinc < Math.abs(startms - targetms ) ) {

                  ms = startms + addinc;

                   asymbol.stop(ms);

                  //500 = 1/2 second = the delay the time interval will wait:

                  setTimeout( timerFunction, 500, ms, targetms, addinc, asymbol);

           

                } else {

                    //finished

                    ms = targetms;

                     asymbol.stop(ms);

                }

          }

          • 2. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
            NEW EXPORT ACCOUNT Level 1

            Hi,

             

            Thanks so much for such a wonderful start! The main thing I don't see is how it would play reverse if the targetms is before the getPosition location.

             

            I also admittedly don't understand how addinc and the setTimeout are being used in the function. Is that to make a certain playback speed...or make the play start after a specified wait duration?

             

            Thanks again for the "only 12 lines" (that's a lot of lines for a script in this app) and also thanks in advance for clarifying!

            This is a simple feature that should be part of EA already. Making buttons that run the timeline from a label to another label and sometimes skipping labels between the labels is so basic and should be easy. 

            • 3. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
              T. Ganoe Level 1

              The variable addinc is the amount you want to increment the timeline by.  I guess I said in the notes that is was the set time out, but that is wrong (sorry!). Example: if you are at the timeline point of 1500 ms and you add 100 then it will move the playhead to 1600 ms. You want to move in small steps so it isn't jumpy.

               

              It will work in reverse, because the formula if ( addinc < Math.abs(startms - targetms)) uses an absolute value, it doesn't care if it is positive or negative, only that it is within that interval, then it will proceed.  If the increment will take it outside the interval, it will stop running.

               

              I agree that it would be nice if you could 'playto' a certain point, like on the old Flash timelines.  I absolutely HAD to have the ability, so I had to write this little function to do it.

               

              • 4. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
                NEW EXPORT ACCOUNT Level 1

                Ah, I see! Yes, it's certainly a basic feature that should be in the API already! Seems that Adobe should add a new employee

                 

                So it automatically parses the Math.abs to make the symbol do a sym.play or sym.playReverse? And to play forward or backward at "normal" speed, should the addinc be 1?

                 

                Thanks again!

                • 5. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
                  NEW EXPORT ACCOUNT Level 1

                  Hi again,

                  Tried that playTo function, yet it doesn't seem to work. Basically want to play to a frame or label on the timeline on a click. And that playTo function should also have some logic to play forward or reverse.

                   

                  Honestly tried multiple ways of using that code. That code simply doesn't seem to function. I'd like to know a way to do this easily.


                  Added that code to the composition.ready and then added the function to a click event. Still didn't function though. Any good recommendations on how to make it function properly? 

                  • 6. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
                    resdesign Adobe Community Professional & MVP

                    Actually I realize I did not answer your question but I had to step away from my desk earlier.PlayTo() a label does not exist and would be a great addition.

                     

                    Depending on what you are doing there are work arounds. I  have some samples to accomplish that but I will have to dig around later to find them.

                     

                     

                     

                     

                    You might want to add this to a feature request. If you can't, I will post that request myself.

                     

                    On Tue, Feb 3, 2015 at 3:50 PM, Marie Goodwyn <mariegoodwyn@gmail.com>

                    1 person found this helpful
                    • 7. Re: VERY IMPORTANT FEATURE TO ADD!: playTo(); or playRange(); for scrollTo() style animation
                      resdesign Adobe Community Professional & MVP

                      Here is a sample for scrollTo with GreenSock

                      https://app.box.com/s/y0ih2sydi53hberd7ipw

                       

                      I wonder if someone on the dev team could see if they could add this feature to EA since it is possible with GreenSock.

                      The other feature requested about are

                      playTo('lable')

                       

                      or

                      play a range

                       

                      All these would be awesome especially if we want to avoid using plugins.