After Effects Tip: How To Fade In & Out Based On Layer In & Out Points

In this post, you will learn how to auto fade in and out based on the layer in and out points in After Effects. Let’s dive right!

Alright, so here we are in After Effects but first let me show you what we will be creating.

ukramedia logo in After Effects

Right now I have the Ukramedia logo in my timeline. The logo fades in based on the in and out points of my layer. Let me show you what I am talking about.

So right when I pass my in point, the logo fades in. Then right before I reach the out point, it
fades out.

Passing in point in After Effects

midpoint after effects

end point fade in After Effects

It does not matter where you place the in or out point. It will do the exact same thing.

So let me show you how to set this up using expressions.

Step 1: Reveal the Opacity

Select the logo in here and then hit T to reveal the opacity.

Select Logo in timeline and press t to reveal the opacity keyboard shortcut

As you can see the opacity percentage is lit up in red, which means I do have an expression applied.

Expressions is applied to opacity

Step 2: Get Rid of the Expression

ALT + Left Click on a PC or OPT + Left Click on a Mac on the stopwatch icon to get rid of the expression.

Alt Click to get rid of expression

Step 3: Create a New Expression

Click on the stopwatch icon again to create a new expression.

Create a new expression in after effects
Next, click on the Expression Helper -> Interpolation and I am  going to select this linear expression: linear(t, tMin, tMax, value1, value2).

Interpolation linear in After Effects

Where it says t,  I am going to change it to say time like so:

linear change to time in after effects

I am going to refer to the time in my timeline from zero to whatever.

linear(time, tMin, tMax, value1, value2).

Basically, this is how it works. tMin is the starting time and tMax is the ending time. tMin is going to give me the value1 and tMax is going to give me the value2.

starting time and ending time in after effects

Now let’s change our starting time tMin to inPoint.

inPoint After Effects

So when I type inPoint, what it does is it gives me the in point of my layer. It is going to be the starting time.

inPoint of my layer in After Effects

So I want the starting time to be zero. To do that we need to change our value1 to zero like so:

linear(time, inPoint, tMax, 0, value2).

Then at inPoint + .5 seconds, I want the opacity to be at 100%. To do that, I need to change tMax to inPoint + .5 and the value2 needs to be changed to 100. It should look like this:

linear(time, inPoint, inPoint + .5, 0, 100).

Now since the in point is working, we need to fade our logo out.

But first, let’s define our expression that we just did to fadeIn like so:

fadeIn = linear(time, inPoint, inPoint + .5, 0, 100).

Now let’s copy our expressions with the copy keyboard shortcut CTRL+C on a PC or CMD+C on a Mac.

copy our expression in after effects

and then paste it below with the keyboard shortcut CTRL+V on a PC or CMD+V on a MAC.

paste expressions in after effects

I am going to change the fadeIn to fadeOut.

fadeOut = linear(time, inPoint, inPoint + .5, 0, 100).

I will then change inPoint to outPoint. I will also subtract .5 seconds instead of adding like so:

fadeIn = linear(time, outPoint – .5, outPoint, 0, 100).

fade in and out in expressions after effects

Now let’s combine them. In the next line I will say:

FadeIn – fadeOut

It should look like this:

fadeOut = linear(time, inPoint, inPoint + .5, 0, 100).

fadeIn = linear(time, outPoint – .5, outPoint, 0, 100).

FadeIn – fadeOut

fade out adobe after effects

Next, I am going to clean this up a little. Instead of saying .5 second in each line, I am just going to create one variable that is going to call for both of them. Let me show you how to do that.

I’m going to place our variable at the very beginning. I will say:

fadeDuration you are going to be .5 seconds like so:

fadeDuration = .5;

and then I will replace the .5 with fadeDuration like so:

fadeDuration = .5;

fadeOut = linear(time, inPoint, inPoint + fadeDuration, 0, 100).

fadeIn = linear(time, outPoint – fadeDuration, outPoint, 0, 100).

FadeIn – fadeOut

and that should do it!

I hope you found this quick tip useful. Make sure to subscribe to our email list for latest After Effects tips.

You can learn more about Expressions at ukramedia.com/expressions

About the author:

Sergei Prokhnevskiy

Sergei Prokhnevskiy is a Charlotte, NC based motion graphics designer, an online tutor, an entrepreneur, and Adobe MAX Master Speaker. Sergei is known for his quick and practical After Effects tips and tricks on YouTube, where he generated well over 6 million views on his tutorials. He has authored an online video course on After Effects Expressions and developed scripts for After Effects. He is also a former senior motion graphics designer at Fox Sports where he worked on graphics for NFL, Super Bowl, MLB, World Series, College Football, NASCAR, Women’s World Cup, and NASCAR Race Hub. He is very passionate about learning and teaching others.

5 FREE TIME-SAVING TOOLS

Over 100,000 downloads & counting!

These 5 After Effects tools will seriously speed up your workflow and save you hours of wasted time. More than that, they could be the difference between being able to complete a project on time or not!