Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions After Effects expression, for scaling a layer 10% over 1 sec, on a slider value.

  • After Effects expression, for scaling a layer 10% over 1 sec, on a slider value.

    Posted by Juan Carlos aguirre on April 26, 2022 at 8:16 pm

    Hello everyone, I’m running a carrousel photo slideshow with a thousand photos, that I’m looking to kind of automate with an expression.

    I have a slider control, that moves my camera to a certain position (photo frame). then that frame scaleup up 10% in about 50frames, and then scales down, then the camera move to a different position, and repeats.

    Is there a way to add an expression to a layer scale property like this?

    If (slider value = xx) then scale up this layer to 110% in (yy seconds) then scale down to 100% in (zz seconds).

    Please let me know this will help me a lot, not to set up all these layers manually.

    Here is a preview of my comp.

    https://www.dropbox.com/s/t5o9bglkg2w03xj/20220423_POLB_Historical_Carousel_01.mp4?dl=0

    Thanks in advance.

    JC.

    Juan Carlos aguirre replied 4 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 26, 2022 at 8:31 pm

    How are you animating the slider value, and how will the expression know which slider value it needs to respond to?

  • Juan Carlos aguirre

    April 26, 2022 at 9:14 pm

    The animation slider its a bit complicated since I have 2 variables, “frame” that its the raw position of my photo, and “fine” that its a fine tune to center

    var frame = effect(“Frame”)(“Slider”);

    var fine = effect(“fine”)(“Slider”)

    {p= (frame * -1663) + fine};

    [p]

    The slider control for the frame is the one I need to link as a target to start the scale-up.

    Exp: If(“Frame”)(“Slider”) = 10, then scale up this layer 10% over xx seconds, then scale down.

    The slider is on a different comp, but I can find out how to link it.

    Let me know if this makes sense.

    Or I can share my project if needed.

  • Dan Ebberts

    April 26, 2022 at 11:44 pm

    It sounds like it might be pretty much the worst case scenario, where you have to use the brute force, frame-by-frame method to find the trigger event. This is a simple example where the expression needs to find when the slider has reached its ID value (which is 10 in this example) and will scale up, hold, and scale down from that point:

    slider = thisComp.layer("Controls").effect("Slider Control")("Slider");

    myID = 10;

    scaleMult = 1.1;

    scaleUpTime = 1.0;

    holdTime = 1.0;

    scaleDnTime = 1.0;

    if (slider.value >= myID){

    t = time;

    while (slider.valueAtTime(t) >= myID){

    t -= thisComp.frameDuration;

    }

    deltaT = time - t + thisComp.frameDuration;

    if (deltaT > scaleUpTime + holdTime + scaleDnTime){

    value;

    }else if (deltaT > scaleUpTime + holdTime){

    linear(deltaT,scaleUpTime + holdTime, scaleUpTime + holdTime + scaleDnTime,value*scaleMult,value);

    }else if (deltaT > scaleUpTime){

    value*scaleMult;

    }else{

    linear(deltaT,0,scaleUpTime,value,value*scaleMult);

    }

    }else

    value

    It assumes that the slider value always increases. The longer your comp is, the worse the performance will get. Hopefully this will get you started.

  • Juan Carlos aguirre

    April 27, 2022 at 4:15 pm

    Awesome, Thank you, Dan.

    Jumping to it, now.

    I assume that the scale and hold variables could also be linked to another slider control right.

    Then I can make global adjustments.

    I’ll try and keep you posted.

    JC.

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