After Effects Opacity Expression - What It Is & How To Use It

The opacity expression in After Effects is a powerful tool that allows you to control the transparency of a layer. It's when your vision can truly come together. If you've set everything up correctly, you'll have all the avenues you'd ever want to get the right look. Using your various render passes, you can use After Effects to dial everything in and add the full vibe you were initially aiming for.

October 29, 2023
After Effects Opacity Expression - What It Is & How To Use It
"Video editors relying on templates lack genuine skill and creativity."

What do you think? Submit your opinion to see what others have to say!

"It's Like Video Editing On Steroids!"
- Sebastian Navarro, FreeVisuals Editor
Endorsed by Adobe, Motion Array is the ULTIMATE tool for creating high-quality videos! Browse 15M+ assets for Premiere Pro, After Effects, FCPX & DaVinci!

Opacity Expression In After Effects

Opacity Expressions in After Effects

Basic Random

This expression will return random opacity values between 0 and the value you set.


Range Random

This expression will generate random opacity values between the two values you set.


Gaussian Distribution

This expression gives a natural randomness based on a bell curve.


What is the Opacity Expression?

The opacity expression is essentially a way to generate random values for the property it's applied to. This might sound simple, but there are different variations of this expression in After Effects that offer unique ways of controlling randomness.

How to Use the Opacity Expression:

  1. Select the Layer: In After Effects, find the layer you want to adjust.
  2. Locate the Opacity Property: This can be found in the timeline panel. If it's not immediately visible, you might need to twirl down the properties of the layer.
  3. Activate Expressions: Hold down the 'Alt' key (or 'Option' on macOS) and click on the stopwatch icon next to the opacity property. This will activate the expressions option.
  4. Enter the Expression: In the field that appears, you can type or paste in the desired expression.

Types of Random Expressions:

  1. Basic Random: The most straightforward form is random();. For instance, random(50); will return random opacity values between 0 and 50 every frame.
  2. Range Random: You can define a range for the random values, like random(40,75);, which will generate random opacity values between 40 and 75.
  3. Gaussian Distribution: This is a more advanced form, gaussRandom();, which gives a natural randomness based on a bell curve, making some values more likely than others.
Controlling the Randomness:

To have consistent random movements every playback, use the seedRandom method. This sets the "seed" value, dictating which random pattern After Effects should use. For instance, seedRandom(20, timeless = false); followed by gaussRandom(20,100); will give you controlled randomness.

Pro Tip: Instead of manually setting a seed value every time, you can use the layer's number as the seed. Simply use seedRandom(index, false); where "index" is the layer number.