Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Random change to a specific color

  • Random change to a specific color

    Posted by Bram Rusman on September 26, 2011 at 1:13 pm

    I have a grid of squares (layered). Now I want to change the color of the squares randomly. But it has to be a specific color. Like in the image. So it randomly changes to blue -light blue – green – blue etc. Is there a way to do this with a expression? It would be very nice if the colors are fading to the other color.

    Bram Rusman replied 14 years, 7 months ago 4 Members · 6 Replies
  • 6 Replies
  • Michael Szalapski

    September 26, 2011 at 2:52 pm

    You might try asking this in the Expressions forum.

    – The Great Szalam
    (The ‘Great’ stands for ‘Not So Great, in fact, Extremely Humble’)

    No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.

  • Roland R. kahlenberg

    September 26, 2011 at 4:08 pm

    Heya Michael, I think Colorama will do the trick.

    Apply Colorama onto an Adjustment Layer and create colors in the Output Cycle property that coincide with the colors that you want for your squares. The sequence that you want the colors to appear in the comp panel should start clockwise, starting from the 12 o’clock mark on the Output Cycle’s circular widget.

    Then animate Cycle Repetitions which denotes the number of times you want the colors to be recycled.

    Should you want more control over the starting colors, you may do so with the Add Phase property within the Input Phase section. To do this, you will need to create a grayscale representation of your grid. Each grid item in the comp panel will be affected by the intensity (lightness) of the corresponding grid item of the grayscale image.

    HTH
    RoRK

    Intensive AE & Mocha Training in Asia.

  • Walter Soyka

    September 26, 2011 at 6:28 pm

    Nice suggestion, Roland.

    I’ll add that you could use a couple instances of Colorama on separate adjustment layers with masks to break up the cycling a little.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Roland R. kahlenberg

    September 26, 2011 at 7:04 pm

    [Walter Soyka] “I’ll add that you could use a couple instances of Colorama on separate adjustment layers with masks to break up the cycling a little.”

    Or perhaps messing about with the Input Phase layer to create the randomness. I just saw that Dan has provided an Expression script as a solution – cool stuff!

    Cheers
    RoRK

    Intensive AE & Mocha Training in Asia.

  • Walter Soyka

    September 26, 2011 at 7:12 pm

    [Roland R. Kahlenberg] “I just saw that Dan has provided an Expression script as a solution – cool stuff!”

    Nice! There’s always more than one way.

    I’ve approached a similar problem differently in the past.

    I created a precomp that contains one square and built the color animation into it with solids and a series of dissolves. In the main comp, I arranged multiple instances of the precomp into the pattern that I wanted, then used Time Remapping (driven by an expression which incorporates the layer’s index) to drive the animation.

    Approaching the problem this way allows you to add specific patterns to the animation based on the layer’s positions in space and stacking order in the timeline, or randomness by altering the expression or stacking order.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Bram Rusman

    September 26, 2011 at 9:18 pm

    Thanks guys for giving help!
    I also posted this question in the expressions forum. There I got a nice solution with a expression from Dan Ebberts. I applied this to a color overlay layer style. And it works fine!

    colors = [[141,203,235,255]/255,
    [187,223,243,255]/255,
    [164,213,239,255]/255,
    [205,219,143,255]/255];
    easeTime = .2;
    segDur = 2;

    curSeg = Math.floor(time/segDur);
    t = time%segDur;
    seedRandom(curSeg,true);
    idx1 = Math.floor(random(colors.length));
    seedRandom(curSeg-1,true);
    idx0 = Math.floor(random(colors.length));
    ease(t,0,.2,colors[idx0],colors[idx1])

    I’ll have to try the solution you mentioned. But for now I’ll use the expression. Deadlines….
    Thanks a lot people!

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