Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random colour fill from a range of preselected colours

  • Random colour fill from a range of preselected colours

    Posted by Katya Ale on December 4, 2020 at 3:23 pm

    Hello to the community!

    Does someone has an idea or could explain the approach to achieve the following animation with windows? –> https://www.sibelga.be/uploads/assets/681/fr/1450961754421-joyeusesfetesFR.gif

    <font face=”inherit”>I exported .ai file in ae, with two layers – top fill and bottom fill (windows). The </font>second layer has (x)amount of groups for each shape (window).

    <font face=”inherit”>I tried to </font>randomise<font face=”inherit”> the fill colour, but it applies the whole layer. Although I am not sure if that is an accurate description, because I have three colours from which the shapes should fill.</font>

    Any suggestions on how to move forward or another approach?

    Many thanks,

    Katya

    Brendon Murphy replied 5 years, 5 months ago 2 Members · 1 Reply
  • 1 Reply
  • Brendon Murphy

    December 9, 2020 at 4:22 am

    It would be best to write a script for randomizing the fill. The steps it executes could be:

    -Use a loop to cycle through all shapes in the selected layer

    -For each one, add a fill property if it doesn’t already exist (to the shapes, not the layer)

    -Pick a random fill color from an array of predetermined colors

    That last step would include something like:

    var currentFill = //your shape's fill property

    var redFill = [1,0,0,1];

    var yellowFill = [1,1,0,1];

    var orangeFill = [1,.5,0,1];

    var fillList = [redFill, yellowFill, orangeFill];

    var randomFill = fillList[Math.floor(Math.random()*fillList.length)];

    currentFill = randomFill;


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