Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to Combine Two Sliders to One Expression (or Two Expression to One Property)

  • How to Combine Two Sliders to One Expression (or Two Expression to One Property)

    Posted by Adira Kessler on August 31, 2020 at 3:59 am

    I have four objects (three are duplicates of the first). I am creating this lens flare text-reveal animation using Optical Flares (plugin from Video Copilot).
    Each word has its own lens flare, and they’re all identical. If I make any change to one, I have to save it as a preset and apply it to the other flares.

    I want them to ENTER consecutively (lens flares move from left to right)

    and EXIT simultaneously (lens flares move from right to left)

    WITHOUT USING KEYFRAMES.

    Individually, these tasks are very easy. I can pick whip them to a slider control and add a delay time to the 2nd, 3rd, and 4th objects. But then they’d all exit consecutively, and I don’t want that.

    I created two sliders, one for the left-to-right animation and the other for the right-to-left animation.

    I am trying to combine the two sliders to one expression  or rather, I am trying to combine two expressions to one property.
    BUT THE SECOND ONE CANCELS OUT THE FIRST. I don’t know how to solve this problem.

    Here are my expressions: (hover your mouse over the expression and scroll sideways to see the rest)
    Beautiful thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point") thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point")
    Meaningful temp = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point").valueAtTime(time - .6) [0];
    [temp, 812]
    temp = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point").valueAtTime(time - .32) [0];
    [temp, 812]

    Powerful temp = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point").valueAtTime(time - 1.4) [0];
    [temp, 1288]
    temp = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point").valueAtTime(time - .57) [0];
    [temp, 1288]

    Message temp = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point").valueAtTime(time - 1.65) [0];
    [temp, 1800]
    temp = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point").valueAtTime(time - .8) [0];
    [temp, 1800]

    As you can see, the delay time is different for each and every object (except for the first one).

    I am sure there is a way to combine two sliders to one expression. I just don’t know how to do it.

    Another issue in terms of combining two expressions into one expression is I also want to combine loopIn AND loopOut expressions because I want the animation to start before the first keyframe and continue after the last keyframe. Again, the second expression cancels out the first.
    UPDATE: I found the solution
    if (time > key(1).time) { loopOut("offset") }
    else { loopIn("offset") }

    Adira Kessler replied 5 years, 8 months ago 1 Member · 2 Replies
  • 2 Replies
  • Adira Kessler

    September 1, 2020 at 9:35 pm

    I cannot believe I figured it out! I will do my best to explain the idea behind the code, and then I’ll just give you the code for your specific situation. The secret to combining two sliders to one property is: Conditional Statement

    The secret formula is the if/else statement and a checkbox control with two keyframes (on then off).
    So, you need to have your sliders equal to a value. the value can be written as anything, a letter a word, a number. I wouldn’t use numbers because it might look confusing.

    v = first slider;
    z = second slider;

    if (thisComp.layer(“LayerName”).effect(“CheckBoxName”)(“Checkbox”).value>0) {v}
    else {z}

    Now, for the other flares, since they’re in different positions (on the y-axis), but you can’t use the “temp =” and the “[temp, 812]” so you need to add the {value + [0,0]}. Oddly, for this situation, I found that I have to subtract 287 from the original number. I don’t know why. I had to play around with it until I got it in the right spot.

    Okay, I don’t know if that made sense that way, so here is what it looks like.

    Beautiful Enter = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point");
    Exit = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point");

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Enter}
    else {Exit}

    Meaningful Enter = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point").valueAtTime (time - .6);
    Exit = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point").valueAtTime (time - .32);

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Enter + [0, 525]}
    else {Exit + [0, 525]}

    Powerful Enter = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point").valueAtTime (time - 1.4);
    Exit = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point").valueAtTime (time - .57);

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Enter + [0, 1001]}
    else {Exit + [0, 1001]}

    Message Enter = thisComp.layer("Flares Animation!").effect("Position Control (Enter)")("Point").valueAtTime (time - 1.65);
    Exit = thisComp.layer("Flares Animation!").effect("Position Control (Exit)")("Point").valueAtTime (time - .8);

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Enter + [0,1513]}
    else {Exit + [0, 1513]}

    I really hope this helps.

  • Adira Kessler

    September 1, 2020 at 9:50 pm

    The same applies to the brightness expressions.

    BeautifulthisComp.layer("Flares Animation!").effect("Show/Hide Slider")("Slider")Meaningful Reveal = thisComp.layer("Flares Animation!").effect("Brightness Slider (Enter)")("Slider").valueAtTime (time - .96);
    Conceal = thisComp.layer("Flares Animation!").effect("Brightness Slider (Exit)")("Slider");

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Reveal}
    else {Conceal}
    PowerfulReveal = thisComp.layer("Flares Animation!").effect("Brightness Slider (Enter)")("Slider").valueAtTime (time - 2);
    Conceal = thisComp.layer("Flares Animation!").effect("Brightness Slider (Exit)")("Slider");

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Reveal}
    else {Conceal}
    MessageReveal = thisComp.layer("Flares Animation!").effect("Brightness Slider (Enter)")("Slider").valueAtTime (time - 2.75);
    Conceal = thisComp.layer("Flares Animation!").effect("Brightness Slider (Exit)")("Slider");

    if (thisComp.layer("Flares Animation!").effect("Slider Switch!")("Checkbox").value>0) {Reveal}
    else {Conceal}

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