1

I want to get the time / duration of the layer, when I stretch or lengthen the layer to produce an effect, for example I want the opacity of a layer to go to 0% 5 frames before the end of the layer, and if I lengthen or I cut that layer that those 5 frames are the same at the end of the layer, regardless of the length of the layer

1 Answer 1

0

This YouTube tutorial explains how to do this:

After Effects Quick Tip - How to Add Auto Opacity To Layers and Footage

  1. Add an expression to the layer's Opacity property by alt-clicking the stopwatch.
  2. Paste this expression into the box:
fadeDuration = .5;
Math.min(linear(time,inPoint,inPoint + fadeDuration, 0, 100), linear(time,outPoint - fadeDuration,outPoint,100,0))

The layer will now fade in for half a second, and then fade out for half a second based on its in and out points.

If want to specify the length in frames instead of seconds, change the first line of the expression to be this:

fadeDuration = thisComp.frameDuration * 5;

Now the layer will fade in and fade out over a period of 5 frames.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.