How To Use The After Effects Random Expression

In After Effects, the random expression is a powerful tool that generates varied values for properties, enhancing animation dynamics.

November 27, 2024
How To Use The After Effects Random Expression

Random Expression In Adobe After Effects

What is the Random Expression in After Effects?

The random expression in After Effects is a powerful tool that generates random values for the property it's applied to. It's versatile and essential, especially when you're looking to add some unpredictability or variation to your animations. Think of it as a way to breathe life into your animations by introducing elements of surprise.

Different Types of Random Expressions:

  1. random(maxValOrArray); - This is the most basic form. For instance, if you use random(50);, After Effects will produce random values between 0 and 50 every frame. The number inside the parentheses is the maximum value for this property.
  2. random(minValOrArray, maxValOrArray); - This gives you more control by allowing you to set both a minimum and maximum value. For example, random(40,75); would generate random numbers between 40 and 75 every frame.
  3. gaussRandom(minValOrArray, maxValOrArray); - This is a bit more advanced and relates to Gaussian distribution.
  4. seedRandom(seed, timeless = false); - This method uses a seed value to control the sequence of numbers. The timeless argument, when set to true, ensures that the random number doesn't vary depending on the time of evaluation.

How to Use the Random Expression:

  1. Adding an Expression: Begin by selecting a layer in After Effects. Then, find the property you wish to affect, such as opacity. Hold down the Option key (or Alt on PC) and click on the stopwatch icon next to your chosen property. This will open the expression editor.
  2. Entering the Expression: You can now type or paste the desired random expression into the expression editor.

A Few Tips for Beginners:

  • Arrays: Some properties in After Effects, like scale or position, require two values. These are known as arrays. For instance, if you're working with position, which requires an x and a y value, you'd use an expression like p = random(50);[p,p]; to get random values for both x and y.
  • Property Limitations: Always be mindful of the property's value limitations when typing out your expressions. This ensures that your code remains clean and efficient.

Basic Random Expression

This expression returns random values between 0 and the number provided.

random(50);

Random Expression with Min and Max

This expression returns random values between the two numbers provided.

random(40,75);

Gauss Random Expression

This expression is based on Gaussian distribution.

gaussRandom(40,75);

Seed Random Expression

This expression uses a seed value to control the sequence of numbers.

seedRandom(123456, true);
random()*100;