2 Replies Latest reply on Aug 4, 2017 1:02 AM by djdigitalhi

    Setting Value of Specific Keyframe of a Slider

    djdigitalhi

      Hi:

       

      Totally new to this and was wondering if it was possible to set a value of a specific keyframe of a slider on a Null object.  So I have a slider control with three keyframes, the first one starting at 0, the second going to another specific value and the third value is the one I want to be able to be user assigned via a dynamic link field or through essential graphics.

       

      The basic idea of the control is to make a meter go up to a number from zero then setting back (or forward) to the ultimate specified value.  Was wondering if there was a way to assign a text frame to the specific key frame's value, or is there another way to do this. 

       

      I'm really new to the scripting aspect of AE so wasn't sure how to apply some similar issues mentioned in the past.

       

      Thanks in advance.

        • 1. Re: Setting Value of Specific Keyframe of a Slider
          Kevin-Monahan Adobe Employee

          Hi djdigitalhi,

          Sorry for this issue. Did you ever find a solution? Please let us know if you have or if you still need help.

           

          Thanks,

          Kevin

          • 2. Re: Setting Value of Specific Keyframe of a Slider
            djdigitalhi Level 1

            Hi Kevin:

             

            Thanks for writing back. Luckily the project wasn't tied to a deadline so I could apply the "let it sit a bit and go back to it later" since banging my head against the desk and trying to make sense of a lot of posts weren't sinking in. 

             

            After combining a few tips across several posts with similar but not quite the same issue, I think I managed to get what I wanted done.

             

            Basically, I had to create an adjustment layer with one slider control to display the counter and another slider control for the value the counter would stop at.  Then I set three key frames on the slider control (which I called Number) that displayed the number where I wanted it to increase and decrease.  So in my case, the first keyframe was set at 0, the second keyframe was at some high number, and the third keyframe I just defaulted it to 0 for now.  Then in the expression for that same slider, I inserted the following expression:

             

            lastval = thisComp.layer("Controls").effect("MaxValue")("Slider")

            t2 = key(2).time;

            t3 = key(3).time;

            if (numKeys == 3) {

                if (time < key(1).time) {

                    value;

                } else if (time < t3-t2) {

                    linear(time,key(1).time,t3-t2,key(1).value,key(2).value);

                } else {

                    linear(time,t3-t2,key(3).time,key(2).value,lastval);

                }

            } else

                value;

             

            Where MaxValue is the ultimate value I wanted the slider control to stop at, and Controls is my adjustment layer.  The Number control was then linked to a text layer that actually displayed the number counting up (and down) as appropriate.

             

            This way I use the MaxValue slider value as the one that can be dynamically linked in Premiere, or via Essential Graphics.  Prior to this I was trying to assign it to the Number control (without the above expression) and was wondering why it was ignoring all my keyframed values (but now I realize why it was doing that... )

             

            Again thanks for checking on this!

            DJD