Flicker Opacity Expression

//FLICKER OPACITY
blinkSpeed =10;
n = Math.sin(time*blinkSpeed);
if (n<=0) 0 else 100;

This After Effects expression is intended to create a flickering effect by adjusting the opacity of a layer over time. Here’s how it works:

  1. Variable Setup:
    • blinkSpeed = 10;: This variable sets the speed of the flicker effect. Higher values will make the flickering faster.
  2. Sine Wave Calculation:
    • n = Math.sin(time * blinkSpeed);: This line calculates a value n using the sine function (Math.sin()).
      • time represents the current time in the composition, and blinkSpeed determines how quickly the flicker occurs.
      • The sine function produces values between -1 and 1, oscillating over time. This will create a smooth flickering effect.
  3. Opacity Adjustment:
    • if (n <= 0) 0 else 100;: This conditional statement adjusts the opacity of the layer based on the value of n.
      • If n is less than or equal to 0 (indicating the trough of the sine wave, where the opacity should be lowest), the opacity is set to 0.
      • Otherwise, if n is positive (indicating the crest of the sine wave, where the opacity should be highest), the opacity is set to 100.
  4. Explanation:
    • When the sine wave of n is at its lowest point (0 or negative), the opacity of the layer is set to 0, creating the flicker effect by making the layer briefly invisible.
    • As the sine wave rises and falls over time, the opacity alternates between 0 and 100, causing the layer to flicker on and off at the specified speed determined by blinkSpeed.

In summary, this expression creates a flickering effect by modulating the opacity of a layer based on a sine wave, resulting in a smooth and rhythmic transition between visible and invisible states. Adjusting the blinkSpeed variable will change the speed of the flickering effect.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *