ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Creating a slider to control opacity of many layers at once

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Synnøve Ludvigsen
Creating a slider to control opacity of many layers at once
on Jul 27, 2018 at 9:06:51 am

Hello Gurus

I did some character rigging seven years ago, and now I'm doing it again, so I know what I want, but my skills are rusty.

So for hands and mouths, I'd like to have only 1 layer visible at the time, and the rest be 0% opacity.

I've created a "slider" that would make layer 1 visible at position 20, layer 2 visible at position 40 etc...


( Apologies for the image. When connected to an arm, it does look like a hand, I swear ☺ )


....but how do I script this?

Very grateful for replies :)


Return to posts index

Andreas Brand
Re: Creating a slider to control opacity of many layers at once
on Jul 27, 2018 at 10:38:26 am

Hello Synnøve

Try this code for the opacity-property of the illustrator-layers.

It should work I think.

Andreas

var posSlider = thisComp.layer("Formebene 1").transform.position[1];

step = 20;
duration = 20;

var min = (index == 3) ? (index-2)*step : (index-3)*step+duration;
var max = (index-2)*‌step+duration;

(posSlider >= min && posSlider &lt; max) ? transparency = 100 : transparency = 0;

transparency


Return to posts index

Andreas Brand
Re: Creating a slider to control opacity of many layers at once
on Jul 27, 2018 at 10:44:29 am

Sorry. The Post in the Forum makes the > to &alt.
I try it again, putting the code in the message-field not in the expression code box.

var posSlider = thisComp.layer("Formebene 1").transform.position[1];

step = 20;
duration = 20;

var min = (index == 3) ? (index-2)*step : (index-3)*step+duration;
var max = (index-2)*‌step+duration;

var transparency = (posSlider >= min && posSlider < max) ? 100 : 0;

transparency


Return to posts index

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