ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to control opacity linked to comp position Y with slider control

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Skylar Moran
Expression to control opacity linked to comp position Y with slider control
on Aug 2, 2017 at 5:35:23 pm

Hello,

I'm using an expression to trigger a fade in and fade out of text once it hits a certain position y in the comp. I want to link the position Y attribute in the expression to a slider control so that I can keyframe the point the fade out happens for multiple layers. Here's the expression I'm using.

Typically this expression would have pixel values after "fadeInStart" and etc, that's where I want to point to a slider value instead of a fixed pixel point. This shows my attempt to do that, but it isn't working in my comp. I'm not getting any expression errors but the fade in and fade out effect just isn't happening no matter what my slider values are set to.

I've probably written something wrong in here. Any help or advice would be appreciated!

Skylar

opacityMin = 0;
opacityMax = 100;

fadeInStart = thisComp.layer("Slider").effect("FADE IN START");
fadeInEnd = thisComp.layer("Slider").effect("FADE IN END");
fadeOutStart = thisComp.layer("Slider").effect("FADE OUT START");
fadeOutEnd = thisComp.layer("Slider").effect("FADE OUT END");

y = toComp(anchorPoint)[1];

if (y &lt;= fadeOutEnd || y >= fadeInStart){
opacityMin;
}else if (y &lt; fadeInStart && y > fadeInEnd){
linear(y, fadeInEnd, fadeInStart, opacityMax, opacityMin);
}else if (y &lt; fadeOutStart && y > fadeOutEnd){
linear(y, fadeOutEnd, fadeOutStart, opacityMin, opacityMax);
}else{
opacityMax;
}



Return to posts index

Dan Ebberts
Re: Expression to control opacity linked to comp position Y with slider control
on Aug 2, 2017 at 5:52:23 pm

I think it will work if you include the Slider property in your slider paths:


opacityMin = 0;
opacityMax = 100;

fadeInStart = thisComp.layer("Slider").effect("FADE IN START")("Slider");
fadeInEnd = thisComp.layer("Slider").effect("FADE IN END")("Slider");
fadeOutStart = thisComp.layer("Slider").effect("FADE OUT START")("Slider");
fadeOutEnd = thisComp.layer("Slider").effect("FADE OUT END")("Slider");

y = toComp(anchorPoint)[1];

if (y <= fadeOutEnd || y >= fadeInStart){
opacityMin;
}else if (y < fadeInStart && y > fadeInEnd){
linear(y, fadeInEnd, fadeInStart, opacityMax, opacityMin);
}else if (y < fadeOutStart && y > fadeOutEnd){
linear(y, fadeOutEnd, fadeOutStart, opacityMin, opacityMax);
}else{
opacityMax;
}



Dan



Return to posts index

Skylar Moran
Re: Expression to control opacity linked to comp position Y with slider control
on Aug 2, 2017 at 5:56:49 pm

That fixed it! Thank you!


Return to posts index

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