Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Using Slider Control to change keyframes, and then looping those keyframes

  • Using Slider Control to change keyframes, and then looping those keyframes

    Posted by David Richards on July 16, 2019 at 10:30 am

    Hello,

    I’m relatively new to AE and have hit a stumbling block.

    I am trying to set up a template – the purpose is to be able to drop in images and text in a kind of carousel that could be repurposed and changed depending on circumstances. The various images and text scale up or down over time, all at the same rate, and I want to be able to control the degree of this scaling using sliders.

    In order to do this with the text, for example, I have set up a null linked to the scale parameter of all text layers. I want to ensure that each of these text layers grows or shrinks at the same rate. I have used the expression below to allow slider control of the first two keyframes.

    My problem is that I don’t know how to then loop these keyframes. If I add loopOut() to the end of this expression, the slider values are ignored, and the keyframes loop as if this code didn’t exist.

    Is there a way to alter the value of keyframes using sliders, and then loop these keyframes?

    Thanks for your help in advance,

    David

    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(2).time;
    sliderStart = effect("Scale Control Start")("Slider");
    v1 = [sliderStart, sliderStart];
    sliderEnd = effect("Scale Control End")("Slider")
    v2 = [sliderEnd, sliderEnd];
    linear(time, t1, t2, v1, v2);
    } else {
    value
    }

    David Richards replied 7 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    July 20, 2019 at 9:50 am

    Try this:

    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(2).time;
    dur = t2-t1;
    sTime = (time-t1)-(time-t1)%dur;
    sliderStart = effect("Scale Control Start")("Slider");
    v1 = [sliderStart, sliderStart];
    sliderEnd = effect("Scale Control End")("Slider")
    v2 = [sliderEnd, sliderEnd];
    linear(time-t1, sTime, sTime+dur, v1, v2);
    } else {
    value
    }

    Andrei
    My Envato portfolio.

  • David Richards

    July 23, 2019 at 10:46 am

    Thank you, Andrei.

    That works exactly as I wished, so I really appreciate you taking the time to reply.

    All the best!

    David

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy