Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animate Between 2 Slider Values Help

  • Animate Between 2 Slider Values Help

    Posted by Sammy Rudkin on August 28, 2024 at 1:27 pm

    Hello!

    Hoping someone can help me out with this.

    I have 2 static Slider values and I’m looking for a way to animate from 0 > Slider 1 > Slider 2 (diagram attached)

     

    Not sure what the best way of doing this is when there are 3 values, as I can’t seem to get the Linear function to work for this. Wondering if there’s some combination of If Else with two different Linear functions to separate between A-B and B-C.

    Many thanks in advance!

     

    Yoan Boisjoli
    replied 3 days, 2 hours ago
    2 Members · 2 Replies
  • 2 Replies
  • Sammy Rudkin

    August 28, 2024 at 1:34 pm

    Since posting this, I have put together an expression that works for what I need it for!

    I have a control slider that animates from 0 – 1 then 1 – 2. This slider has the following expression:

    anim = value;

    startval = thisComp.layer(“CONTROLS”).effect(“START”)(“Slider”);

    endval = thisComp.layer(“CONTROLS”).effect(“END”)(“Slider”);

    if (anim<1) {linear(anim,0,1,0,startval)}

    else {linear(anim,1,2,startval,endval)}


    Still interested in case there’s a more efficient way of doing this, so open to ideas 🙂

  • Yoan Boisjoli

    September 5, 2024 at 3:37 pm

    Hi Sammy!

    I think something like this would work:

    anim = value;

    startval = thisComp.layer(“CONTROLS”).effect(“START”)(“Slider”);

    endval = thisComp.layer(“CONTROLS”).effect(“END”)(“Slider”);

    linear(anim, 0, 2, 0, endval)

    Although If you still want to preserve control over the “midpoint” value (B), you can adjust the scaling and leverage a remapping approach:

    anim = value;

    startval = thisComp.layer(“CONTROLS”).effect(“START”)(“Slider”);

    endval = thisComp.layer(“CONTROLS”).effect(“END”)(“Slider”);

    // Midpoint value (Slider 1)

    midval = (startval + endval) / 2;

    // Remap anim from 0-2 range to startval-midval-endval

    linear(anim, 0, 2, 0, endval);

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