[2024] Flicker Expression In After Effects - How To Use It

When you're working in After Effects, there are times when you want to create a flickering effect, perhaps to simulate a light bulb flickering or a screen glitch. The flicker expression is a powerful tool that can help you achieve this without the tedious task of setting numerous opacity keyframes.

November 26, 2023
[2024] Flicker Expression In After Effects - How To Use It
"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!

Adobe After Effects Flicker Expression Guide

Flicker Expressions

Basic Flicker Expression

blinkRate = 10;
n = Math.sin(time * blinkRate);
if (n < 0) 0;
else 100;

This basic expression uses the Math.sin function to create a flickering effect based on the defined blink rate.

Advanced Flicker Expression

t = framesToTime(time, thisComp.frameDuration) + (thisLayer.index * 12345);
function isPrime(value) {
  for(var i = 2; i < value; i++) {
    if(value % i === 0) return 100;
  return 0;

This advanced expression checks if the current frame is prime to determine the opacity, creating a unique flickering effect.

What does the flicker expression do?

The flicker expression in After Effects is used to create a blinking or flickering effect on a layer. Instead of manually animating the opacity of a layer using keyframes, you can use this expression to automate the process. This is especially useful when you want to make adjustments or create a consistent flickering effect across multiple layers.

How to use the flicker expression:

  1. Locate the Opacity Control: In your After Effects interface, select the layer you want to apply the flicker effect to. Navigate to the "Effect Controls" panel. If you can't find it, go to the top menu and click on "Window" and ensure "Effect Controls" is checked. Within the "Effect Controls" panel, you'll find the "Opacity" control.
  1. Alt-Click on the Stopwatch: Next to the "Opacity" control, there's a stopwatch icon. Hold down the 'Alt' key on your keyboard and click on this stopwatch. This action will open up a text box where you can type in your expression.
  2. Type in the Expression: There are various ways to write a flicker expression, but a common method involves using the Math.sin equation. This equation returns a value between -1 and 1. Based on this value, you can instruct After Effects to change the opacity of the layer. For instance, if the returned value is less than zero, you can set the opacity to 0 (making the layer invisible), and if the value is greater than zero, you can set the opacity to 100 (making the layer fully visible).
  1. Adjust the Blink Rate: The blinkRate in the expression determines how fast the layer flickers. By adjusting this value, you can control the speed of the flickering effect.
  2. Preview: Once you've entered the expression, you can play back your composition to see the flickering effect in action. If it's too fast or too slow, simply adjust the blinkRate value.

It's at this juncture that your vision can truly come together. If you've set everything up correctly, you'll have all the options and avenues you'd ever want to achieve the right look. Using the flicker expression, you can dial everything in and add the exact vibe you were aiming for. The idea is to have everything set up in such a way that you can make the majority of your creative decisions at this phase. It makes it so easy to iterate, customize, and achieve the exact feeling you were going for.