Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Controlling varying levels of opacity with one slider

  • Controlling varying levels of opacity with one slider

    Posted by Stephen Mendenhall on April 28, 2015 at 5:13 pm

    Thanks in advance for any help on this. My knowledge of expressions is fairly limited, so I am assuming this may be basic.

    I have multiple layers that need different levels of opacity adjusted simultaneously, and I would like to do this with one slider. For example, when the slider value is “45”, one layer’s opacity reaches 100%, while another’s goes to 30%. Then when the slider reaches “90”, the layer that was at 100% goes to 30%, then the second layer goes from 30% to 100%.

    Or maybe more simply put, I would like the maximum value range of 100% opacity to be defined by a specific number on a slider, and the further it goes from that number, the opacity decreases.

    Thanks again!
    -Stephen

    Stephen Mendenhall replied 11 years ago 2 Members · 3 Replies
  • 3 Replies
  • Stephen Mendenhall

    April 28, 2015 at 5:34 pm

    Thanks for your quick response David.

    My slider has three key values: 0,45,90 (chosen because of corresponding angles when rotating an object that is controlled by the same slider).

    When the slider is at “0”, I want layer A to be 100% opacity and layers B and C at 30% opacity.
    When the slider is at “45”, I want layer A to drop to 30% opacity and Layer B to raise to 100% opacity.
    When the slider is at “90”, I want layer B to return to 30% opacity and layer C to raise to 100% opacity.

  • Walter Soyka

    April 28, 2015 at 6:56 pm

    [Stephen Mendenhall] “When the slider is at “0”, I want layer A to be 100% opacity and layers B and C at 30% opacity.
    When the slider is at “45”, I want layer A to drop to 30% opacity and Layer B to raise to 100% opacity.
    When the slider is at “90”, I want layer B to return to 30% opacity and layer C to raise to 100% opacity.”

    You will need a separate expression on the opacity property of each layer.

    There is a function called “linear” which translates one range of values to another. In this case, we’ll use it to translate your input control values to your output opacity values. The basic syntax is this:

    linear(input, minimumInput, maximumInput, outputBegin, outputEnd);

    Here’s an example:

    linear(time,0,10,50,100);

    Translated to English, this says “As the value of time goes from 0 seconds to 10 seconds, return an output from 50 to 100. Thus, time=0 will return 50, time=5 will return 75, and time=10 will return 100.

    Alt+click the opacity stopwatch and enter expressions like the following:

    LAYER A
    control = thisComp.layer("Contol Layer").effect("Slider Control")("Slider");
    linear(control, 0, 45, 100, 30);

    LAYER B (this one is a little trickier because you have to see whether you’re coming into 45 or going out of it)
    control = thisComp.layer("Contol Layer").effect("Slider Control")("Slider");
    if (control < 45) linear(control, 0, 45, 30, 100)
    else linear(control, 45, 90, 100, 30);

    LAYER C
    control = thisComp.layer("Contol Layer").effect("Slider Control")("Slider");
    linear(control, 45, 90, 30, 100);

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Stephen Mendenhall

    April 28, 2015 at 8:12 pm

    Perfect!
    I suspected it was something relatively simple. Man I need to get better at expressions.
    Thank you!

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