<p>You can do this with an expression on the Opacity property:</p>

<pre><code>fade = framesToTime(10);
fadeIn = (time - inPoint) / fade;
fadeOut = (outPoint - time) / fade;
if (time &lt; inPoint + fade) { ease(fadeIn, 0, 1) * value }
else if (time &gt; outPoint - fade) { ease(fadeOut, 0, 1) * value }
else { value }
</code></pre>

<p>This expression will fade the layer from 0% to 100% Opacity across the first 10 frames, then fade from 100% to 0% on the last 10 frames of the layer. This is based on the layer's in and out points on the timeline.</p>

<p>Full tutorial (starts at 3:08):</p>

<p><div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/BOPfs49VfLE?start=188"></iframe>
            </div></div></p>

<p>Hope this helps!</p>

CC BY-SA 4.0
2018-09-20T01:01:07.373Z
objective and effective response
LCarvalho
CC BY-SA 3.0
2018-04-08T08:44:18.317Z
2018-04-08T08:44:18.317Z
Parker Young
<p>Is there any shortcut where I can apply a 0% opacity at the beginning of the layer and 100% opacity after 10 frames after the beginning of the layer and can do the reverse as well?</p>

<after-effects>
Opacity depending on the layer
LCarvalho
# Opacity depending on the layer

(Asked by: username_0 on 2018-03-20)

Is there any shortcut where I can apply a 0% opacity at the beginning of the layer and 100% opacity after 10 frames after the beginning of the layer and can do the reverse as well?

**Tags:** after-effects


---

## 1 answers

### Answer by username_1 on 2018-04-08. Score: 1 | Accepted answer

You can do this with an expression on the Opacity property:
fade = framesToTime(10);
fadeIn = (time - inPoint) / fade;
fadeOut = (outPoint - time) / fade;
if (time < inPoint + fade) { ease(fadeIn, 0, 1) * value }
else if (time > outPoint - fade) { ease(fadeOut, 0, 1) * value }
else { value }

This expression will fade the layer from 0% to 100% Opacity across the first 10 frames, then fade from 100% to 0% on the last 10 frames of the layer. This is based on the layer's in and out points on the timeline.
Full tutorial (starts at 3:08):



Hope this helps!

> **Comments:**
> **username_0**: objective and effective response  

---

