ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling varying levels of opacity with one slider

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Stephen MendenhallControlling varying levels of opacity with one slider
by on Apr 28, 2015 at 5:13:17 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


Return to posts index

Dave LaRondeRe: Controlling varying levels of opacity with one slider
by on Apr 28, 2015 at 5:20:57 pm

You might not need to jump through all those expression hoops.

What precisely are you trying to accomplish? Proportionate opacity among multiple layers?

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Stephen MendenhallRe: Controlling varying levels of opacity with one slider
by on Apr 28, 2015 at 5:34:05 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.


Return to posts index


Dave LaRondeRe: Controlling varying levels of opacity with one slider
by on Apr 28, 2015 at 6:11:59 pm

Wow, now there's a rat's nest. I'd take this question to the COW's AE Expressions forum. If anyone can help you, they can.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index


Walter SoykaRe: Controlling varying levels of opacity with one slider
by on Apr 28, 2015 at 6:56:43 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Stephen MendenhallRe: Controlling varying levels of opacity with one slider
by on Apr 28, 2015 at 8:12:36 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]