ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

FAQ   •   VIEW ALL
 Fade In and Out on Jan 3, 2019 at 5:41:48 pm

Can anyone Plz describe me How This Expression Work? When i Appy this Into Opacity it Makes Laye fade in and Fade Out I want To know physics behind it.

```i = linear(time, inPoint, inPoint+.5, 0, 100); o = linear(time, outPoint-.5, outPoint, 0, 100); i-o```

 Re: Fade In and Outon Jan 3, 2019 at 6:02:39 pm

Variable "i" gets its value from remapping the time value between the inpoint time of the layer and the inpoint time plus 0.5 seconds to the range of 0 to 100. Thus at inpoint the value of i is 0, from where it rises up to 100 in the following 0.5 seconds.

Variable "o" gets it's value similarly (in reverse) at the endpoint of the layer by remapping time from 0 to 100.

When you subtract o from i you get both variables affecting the opacity.

To understand the linear() function better, check it out in the AE expressions reference.

Kalleheikki Kannisto
Senior Graphic Designer

 Re: Fade In and Outon Jan 8, 2019 at 9:02:00 am

Why Only subtract Works Perfect Why It Doesn't when i do "i + o"

 Re: Fade In and Outon Jan 8, 2019 at 12:38:55 pm

If you add the values then in the end it goes from 100 to 200, not 100 to 0.

Kalleheikki Kannisto
Senior Graphic Designer

 Re: Fade In and Outon Jan 8, 2019 at 2:17:38 pm

Here are a couple of other ways to do it that might make more sense (because the calculation for o goes in the direction you expect):

i = linear(time, inPoint, inPoint+.5, 0, 100);
o = linear(time, outPoint-.5, outPoint, 100, 0);
Math.min(i,o)

i = linear(time, inPoint, inPoint+.5, 0, 100);
o = linear(time, outPoint-.5, outPoint, 100, 0);
time < (inPoint+outPoint)/2 ? i : o

Dan