Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Scripting random color bars expression?

  • Scripting random color bars expression?

  • wyclef chron

    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.

  • 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;
    seedRandom(index,true);
    [random(minWidth,maxWidth),thisComp.height]

    Add this expression to the Fill Color:

    minVal = [.5,.5,.5,1];
    maxVal = [1,1,1,1];
    seedRandom(index,true);
    random(minVal,maxVal)

    Add this expression to the Layer’s Position:

    minFreq = .25;
    maxFreq = .75;
    seedRandom(index,true);
    freq = random(minFreq,maxFreq);
    amp = thisComp.width/2;
    w = wiggle(freq,amp);
    [w[0],value[1]]

    Add this expression to the Layer’s Opacity:

    minVal = 25;
    maxVal = 100;
    seedRandom(index,true);
    random(minVal,maxVal)

    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.

Viewing 1 - 3 of 3 posts

Log in to reply.

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