
Random Fixed Color Expression
Andy Ford June 28, 2022
0 Comments
This tutorial expands upon my previous tutorial on creating a random color expression. That expression randomly changed color of your shape layer, but you achieved values that were in between the range of colors you selected. This tutorial features expressions to help you randomly change between fixed colors and not get the in-between values.
Some contents or functionalities here are not available due to your cookie preferences!
This happens because the functionality/content marked as Google Youtube uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.
First, we add color controls to our shape layer for each color that we want to appear. Then, we set an expression for our shape's fill color and create variables for each and add those variables to an array. We can control the value of the array by adding a slider control, and then return the value of the array (which is determined by the slider).
Once you add Math.floor to your slider value to eliminate complexities when your slider value is not a whole number, you can control the color shown based on your slider value.
var color1 = effect( Color Control 1 )( Color );
var color2 = effect( Color Control 2 )( Color );
var color3 = effect( Color Control 3 )( Color );
var color4 = effect( Color Control 4 )( Color );
var color5 = effect( Color Control 5 )( Color );
colors=[color1,color2,color3,color4,color5];
slider=Math.floor(effect( Slider Control )( Slider ));
colors[slider];
To automate this, we need to do more. We must make a variable that makes this whole expression go. For this, we create a variable that is equal to Math.floor(time/slider). This creates a whole number value that is always changing and makes your slider value act as a throttle or speed control.
This expression needs to work in conjunction with seedRandom. The seedRandom method allows you to replay the same random movements every time. The seed value is the variable we just created above, and then we need to complete the seedRandom method with a timeless argument that is either true or false. In this case, we want to use true because that makes this timeless. By that, I mean it stays the same on each frame but still chooses a random value. If you select false, everything changes each frame, which is not what is needed in this instance.
Now we need another value that helps choose the color. Set this to Math.floor(random(colors.length)). This adds the randomness into the equation, and sets the confines of the randomness to the number of values in your array. Finally, we return the value of the colors, which in the variable just created.
var color1 = effect( Color Control 1 )( Color );
var color2 = effect( Color Control 2 )( Color );
var color3 = effect( Color Control 3 )( Color );
var color4 = effect( Color Control 4 )( Color );
var color5 = effect( Color Control 5 )( Color );
colors=[color1,color2,color3,color4,color5];
slider=effect( Slider Control )( Slider );
engine=Math.floor(time/slider);
seedRandom(engine,true);
colorChoose=Math.floor(random(colors.length));
colors[colorChoose];
Speed of color change is regulated by the slider control value.
###
Enjoying this tutorial? Sign up now for the Creative COW Newsletter!
Sign up for the Creative COW newsletter and get weekly updates on industry news, forum highlights, inspirational tutorials, tips, burning questions, and more! Receive bulletins from the largest, longest-running community dedicated to supporting professionals working in film, video, and audio.
Enter your email address, a first and last name, and let us know what you'd like to see more of in the message!
.grecaptcha-badge{visibility:hidden}.meow-contact-form .meow-contact-form__header{display:flex;margin-bottom:10px}.meow-contact-form .meow-contact-form__header .meow-contact-form__header__content{flex:1;display:flex;flex-direction:column;justify-content:center}.meow-contact-form .meow-contact-form__header .meow-contact-form__header--image--left{margin-right:10px}.meow-contact-form .meow-contact-form__header .meow-contact-form__header--image--right{margin-left:10px}.meow-contact-form--editor input{color:gray}.meow-contact-form--default{font-size:18px}.meow-contact-form--default input:not([type=submit]),.meow-contact-form--default textarea{width:100%}.meow-contact-form--default input[type=submit]{padding:10px 40px;font-size:18px;line-height:18px}.meow-contact-form--default .meow-contact-form__info{margin-top:-10px;margin-bottom:10px;font-size:14px}.meow-contact-form--default .meow-contact-form-message{font-style:italic}.meow-contact-form--default .meow-contact-form__group{margin-bottom:15px;font-size:16px}.meow-contact-form--default .meow-contact-form__group .meow-contact-form__group-input,.meow-contact-form--default .meow-contact-form__group .meow-contact-form__group-textarea{margin-top:3px;padding:5px;font-size:14px}.meow-contact-form--default .meow-contact-form__header{margin-bottom:15px}.meow-contact-form--default .meow-contact-form__header__content--title{font-size:24px;line-height:24px}.meow-contact-form--default .meow-contact-form__header__content--text{margin-top:5px;font-size:16px;line-height:16px;color:gray}.meow-contact-form--default .meow-contact-form__group-button{padding:10px 20px;border:none;margin-top:10px;cursor:pointer}.meow-contact-form--default .meow-contact-form__group-button:hover{filter:brightness(1.05)}.meow-contact-form--meowapps{padding:20px;box-shadow:0 0 5px #d8d8d8;font-size:18px;background:#fff;color:#333}.meow-contact-form--meowapps input:not([type=submit]),.meow-contact-form--meowapps textarea{width:100%;border:#e7e7e7 solid 1px}.meow-contact-form--meowapps .meow-contact-form__info{margin-top:-10px;mar
Most recent headlines
05/01/2027
Worlds first 802.15.4ab-UWB chip verified by Calterah and Rohde & Schwarz to be ...
21/11/2026
Billie Jean King and Ilana Kloss attend the premiere of Give Me the Ball! by Liz Garbus and Elizabeth Wolff, an official selection of the 2026 Sundance Film Fes...
21/11/2026
Compressor plug-in free for first two weeks
The latest plug-in to join fedDSP's Amps & Pedals line-up has just arrived, and the company are kindly offer...
21/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
21/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
21/11/2026
A larger studio puts more distance between the lights and the people who need to look good under them. Brightline Lighting, a manufacturer of energy-efficient l...
21/11/2026
LA JOLLA, CA-Despite its enormous impact on individuals, families and communities, addiction remains an area of significant unmet medical need.
A $7 million gi...
21/11/2026
27 FANGORIA Chainsaw Awards Nominees Created with Blackmagic Design
Brie Clayton November 20, 2026
0 Comments
Blackmagic Design hardware and software ...
21/11/2026
Qube Cinema Named Technical Partner for 57th International Film Festival of Indi...
20/11/2026
The sports broadcaster's chairman sees the upcoming game as an opportunity t...
20/11/2026
In-venue and creative video staffers at the professional and collegiate level have one major thing in common: the intensity and attention to detail ramps up dur...
20/11/2026
A variety of LED displays, integrated broadcast infrastructure covers every angl...
20/11/2026
Real American Freestyle (RAF) has announced a distribution partnership with Migu Video, a Chinese digital sports platform, to carry the RAF15 main event between...
20/11/2026
Apple and F1 Academy have announced that the all-female racing series will stream on Apple TV in the U.S. beginning in 2027. Fans will be able to watch every qu...
20/11/2026
Regional broadcaster m nchen.tv has modernized its production infrastructure at a new location in northern Munich. Riedel MediorNet provides decentralized signa...
20/11/2026
Eutelsat has announced three appointments to its Executive Committee, effective November 2026, under CEO Jean-Fran ois Fallacher.
Jean-Hubert Lenotte is appoin...
20/11/2026
After more than two decades at Harbour Esplanade in Docklands, the Seven Network has relocated its Melbourne headquarters to a new, custom-built ST 2110 facilit...
20/11/2026
Brazil is among the first markets deploying Versatile Video Coding (VVC) as part...
20/11/2026
The Soccer Tournament (TST), the $1 million winner-take-all 7v7 world championsh...
20/11/2026
Enhancements include a larger compound, an elevated camera count, and a whole lo...
20/11/2026
Leaders from ESPN, iHeartMedia, and Just Women's Sports explore creating new...
20/11/2026
New EQ plug-in aimed at mastering duties
Lemur Audio's latest plug-in has just arrived, delivering a characterful EQ that's aimed primarily at maste...
20/11/2026
Discounts of up to 75% now available
Soundtoys' annual Black Friday sale is now live, with discounts of up to 75% applied across the company's range...
20/11/2026
New creative looping tool revealed
Described as a cycling audio fragmenter , the latest addition to the SoundGhost range draws its inspiration from tape ph...
20/11/2026
Fairchild recreation gets plug-in counterpart
Heritage Audio's Herchild 670 offers a meticulous hardware recreations of the much-loved Fairchild 670 and...
20/11/2026
BONDI: 7 Minutes That Changed Australia
16 November, 2026
Media releases
A landmark documentary chronicling the worst terror attack in modern Australian hi...
20/11/2026
Statement regarding SBS non-Executive Director Aaron Fa'Aoso
20 November, 2026
Media releases
Aaron Fa'Aoso has advised that he is stepping down a...
20/11/2026
INVITATION FOR PUBLIC COMMENTS AND OBJECTIONS ON NOMINEES FOR APPOINTMENT TO THE COUNCIL OF THE NATIONAL FILM AND VIDEO FOUNDATION (NFVF) The Department of Spor...
20/11/2026
UEFA Nations League football and autumn premieres propel TVP to number one as YouTube grows its TV screen share
Warsaw, Poland, November 19, 2026 - Nielsen, a...
20/11/2026
October's autumn weather clearly encouraged Poles to spend more time in front of their screens, resulting in both longer viewing times and a higher overall ...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
DigitalGlue releases creative.space Pulse, a free Mac app that shows creatives w...
20/11/2026
How NBCUniversal Telemundo Used Virtual Production for its FIFA World Cup 2026 C...
20/11/2026
What Film School Pays and What it Costs: The Federal Numbers
Mark Santos November 20, 2026
0 Comments
Every editor has had the argument about film sch...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Share
{alert(Link copied)}).catch(err => {console.error(Failed to copy: , err)}) data-platform=copy_link data-action= class=font-ui-heading py-2 text-sm tex...
20/11/2026
Beam Dynamics has introduced new Model Context Protocol (MCP) support, expanding how customers can work with the live operational data held in Beam. The new cap...
20/11/2026
Re:Vision Effects Cyber Week Sale Nov 24 to Nov 30
Pierre Jasmin November 19, 2026
0 Comments
Long time friends of the COW are up with a big sale!
Us...
20/11/2026
Avid is offering up to 33% off annual subscriptions!
Brie Clayton November 19, 2026
0 Comments
Hero image courtesy Deposit Photos
Pro Tools
Pro To...
19/11/2026
With a sports-bar vibe and all the teams onsite in a huge atrium in Ballpark Vil...
19/11/2026
The senior from Phoenix and England is balancing life as a Division I tennis player with a growing career behind the microphone
The future of live sports produ...
19/11/2026
RED Digital Cinema and Colorfront have partnered to integrate native Colorfront color management into RED Connect, letting productions apply Colorfront's co...
19/11/2026
SMPTE has published an engineering report summarizing an industry survey by its Study Group on Content Provenance and Authenticity in Media. The findings point ...
19/11/2026
CTech and Skyline Communications have announced a partnership to deliver integra...
19/11/2026
Euskal Irrati Telebista (EITB), the Basque Country's public media group, has completed Phase 1 of a five-studio renewal with the commissioning of a Lawo IP ...