View all expressions
Transformation

Automatic Fade In and Out with Sliders and Checkboxes

Fades a property in or out using checkbox toggles and custom sliders for duration, start, and final values. This removes the need for keyframes and makes the fade fully customizable.

Contributed by:


fadeDuration = effect("Fade Duration")("Slider");
// Duration of the fade (in seconds)
zeroValue = effect("Zero Value")("Slider");
// Value at the start and end
finalValue = effect("Final Value")("Slider");
// Constant value during playback
enableFadeIn = effect("Enable Fade In")("Checkbox") == 1;
enableFadeOut = effect("Enable Fade Out")("Checkbox") == 1;
currentTime = time - inPoint;
layerOut = inPoint + thisLayer.outPoint - thisLayer.inPoint;
// Calculates actual outPoint inside the parent comp
timeToEnd = layerOut - time;
// Time remaining before fade out
if (enableFadeIn && currentTime < fadeDuration) {
// Fade-in logic
t = currentTime / fadeDuration;
fadeValue = ease(t, 0, 1, zeroValue, finalValue);
}
else if (enableFadeOut && timeToEnd < fadeDuration)
{
// Fade-out logic
t = (fadeDuration - timeToEnd) / fadeDuration;
fadeValue = ease(t, 0, 1, finalValue, zeroValue);
}
else if (enableFadeIn || enableFadeOut){
// Hold value if either fade is enabled and active
fadeValue = finalValue;
}
else
{
// No fading applied — use final value
fadeValue = finalValue;
}
fadeValue;

Automatic Fade In and Out with Sliders and Checkboxes

Practical use case

Ideal for MOGRTs, templates, and automated scenes where designers want full UI control over fade animations.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image