-
Expression to control opacity linked to comp position Y with slider control
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 <= 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;
}