2 Replies Latest reply on Oct 28, 2014 5:03 AM by Rick Gerard

    How to control the speed of a loopOut expression

    Camrb_1234 Level 1

      I have a looped walk-cycle of an elephant that I would like to control the speed of using a slider controller or similiar.

       

      I have a 25f walk cycle that Ive used the loopOut expression on. I would like to add to this something to control the speed of the loop so I can easily make the elephant walk, run or stop.

       

      Im not an Expression genius so would like some advice on how to go about this.

       

      Cheers

        • 1. Re: How to control the speed of a loopOut expression
          Mylenium Most Valuable Participant

          COnvert the expression to keyframes using the respective keyframe assistant, pre-compose, time-remap.

           

          Mylenium

          • 2. Re: Re: How to control the speed of a loopOut expression
            Rick Gerard Adobe Community Professional & MVP

            Trying to create a rate slider is going to be complex. Dan Ebbert's MotionScript site has an explanation of how to write an expression for a speed control slider. It would be a good page to study.

             

            I would adjust the keyframes of my walk cycle so it was at the slowest speed, pre-compose, then adjust pre--comp settings and extend the length so it was much longer than the main comp and extend the walk cycle or you'll run out of cycles before the main comp ends. I would not convert your expression to keyframes because it is not necessary.

             

            Dan has an example that uses audio to drive time remapping. I already have all of his expressions for rate control in my animation presets library and use them all the time. I customized each or them to suit my typical needs. To customize his audio driving time remapping example I replaced the Audio Keyframes slider with an Effects Control slider attached to the layer. For a walk cycle you may want to keep all the values positive and animate between 0 and something like 3. I'm not sure what a walk cycle would look like while it was reversing.

             

            Here's what the expression looks like:

            spd = effect("Slider Control")("Slider");

            mult = .5;

            n = spd.numKeys;

            if (n > 0 && spd.key(1).time < time){

              accum = spd.key(1).value*(spd.key(1).time - inPoint);

              for (i = 2; i <= n; i++){

                if (spd.key(i).time > time) break;

                k1 = spd.key(i-1);

                k2 = spd.key(i);

                accum += (k1.value + k2.value)*(k2.time - k1.time)/2;

              }

              accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;

            }else{

              accum = spd.value*(time - inPoint);

            }

            value + accum*mult

            Here's the animation preset: TimeRemapSpeedControl.ffx

            All you have to do is pre-compose, adjust the length of your pre-comp, then apply the expression and add keyframes.