Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scripting random color bars expression?

  • Scripting random color bars expression?

    Posted by Wyclef Chron on November 30, 2022 at 5:33 pm

    Hi, I am interested in creating some vertical color bars of varying widths, opacity, color moving horizontally across the screen back and forth and varying speeds. I could manually animate this, but it feels a bit cumbersome and would like something that could maybe be reproduced across different compositions. Wondering if anyone has seen an example of something like this, or has a clue how to script something of this nature.

    Wyclef Chron replied 1 year, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 30, 2022 at 6:00 pm

    To get you started, create a Shape Layer (Layer > New > Shape Layer). Add a Rectangle and a Fill.

    Add this expression to the Rectangle’s Size property:

    minWidth = 5;
    maxWidth = 25;

    Add this expression to the Fill Color:

    minVal = [.5,.5,.5,1];
    maxVal = [1,1,1,1];

    Add this expression to the Layer’s Position:

    minFreq = .25;
    maxFreq = .75;
    freq = random(minFreq,maxFreq);
    amp = thisComp.width/2;
    w = wiggle(freq,amp);

    Add this expression to the Layer’s Opacity:

    minVal = 25;
    maxVal = 100;

    Duplicate the layer a bunch of times.

  • Wyclef Chron

    December 1, 2022 at 4:55 pm

    Thanks for this! Will see what I can do and circle back.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy