
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 ...
17/10/2026
At PBR Teams Series: Maverick Days at UBS Arena in Belmont Park, NY, PBR Executi...
17/10/2026
By Ramona Flume
Speaking out against injustice rarely comes without a price. Th...
17/10/2026
Two new kit options introduced
Roland's entry-level V-Drum series has just been refreshed, gaining two new kit options that promise the best balance of ...
17/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
17/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
17/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
17/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
17/10/2026
Oklahoma filmmaker Elijah Felkins launches crowdfunding campaign to shoot Kairat...
17/10/2026
Secret Weapon Post Powers New Remote Workflows with DaVinci Resolve Studio
Brie Clayton October 16, 2026
0 Comments
Going remote: redefining what post...
17/10/2026
Danilo P rez Premieres New Work Honoring Architect Frank Gehry Commissioned by the Herbie Hancock Institute, P rez performed The Ever-Changing World at its In...
17/10/2026
NVIDIA RTX Spark laptops are now available, bringing NVIDIA Blackwell RTX graphics, up to 128GB of unified memory and the full NVIDIA AI platform to slim, premi...
16/10/2026
The LA Clippers have announced their local television plan for the 2026-27 seaso...
16/10/2026
At sports-media summit, he describes the success of the one-year-old agreement a...
16/10/2026
Parks Associates, in partnership with InterDigital, has published a white paper ...
16/10/2026
Cisco is expanding its work with the Atlanta Hawks, Cleveland Cavaliers, and Brooklyn Sports & Entertainment (BSE) as the 2026-27 NBA season gets underway, prov...
16/10/2026
Broadcast Management Group (BMG) has introduced Media Command, a private cloud broadcast platform that integrates recording, media asset management (MAM), chann...
16/10/2026
TNDV and GameTime Productions have expanded their remote production responsibilities for Team Boxing League (TBL) for the league's recently completed fourth...
16/10/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...
16/10/2026
Broadcast and streaming are converging around live media. Traditional broadcasters increasingly distribute their linear services through streaming platforms alo...
16/10/2026
DAZN and Guardians League, a new professional franchise surf racing series, have announced a multi-year global broadcast partnership. Guardians League events wi...
16/10/2026
Sobatech Group is producing live coverage of the F4 Spanish Championship and Eur...
16/10/2026
The Walt Disney Company and Dude Perfect have announced an integrated creative partnership. Dude Perfect will develop original content for its own channels insp...
16/10/2026
Onsite studio show will accompany game productions in San Francisco and Atlanta
...
16/10/2026
Grass Valley s AMPP platform continues to grow in popularity, especially with th...
16/10/2026
FloSports and the National Lacrosse League (NLL) have entered a multiyear media partnership that makes FloSports the exclusive global streaming home of the NLL....
16/10/2026
At PBR Teams Series: Maverick Days at UBS Arena in Belmont Park, NY, PBR Executive Producer Jason Jacquette took a few minutes with SVG to discuss how his team ...
16/10/2026
(Suzanne Cordeiro/Shutterstock for Sundance Film Festival)
By Patty Consolazio
...
16/10/2026
Standalone calibration, automatic bass management & digital I/O
The ARC Studio was a significant release for IK Multimedia, and was praised for offering a c...
16/10/2026
Classic compressor returns in 1U form
There are few pieces of gear that have achieved the status held by the SSL Bus Compressor, and it's now officially...
16/10/2026
Latest cinematic instrument unveiled
Zero-G say that their latest creation isn't your typical sample library or collection of instruments, but rather a ...
16/10/2026
Real-time MIDI orchestrator updated
Forma Labs Audio have recently launched a significant update that brings some powerful new features to their real-time M...
16/10/2026
The launch of the autumn programming schedules on traditional TV channels translated into a noticeable increase in total video viewership. Poles spent an averag...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Globecast, a leading provider of media integration and managed services for the sports broadcast industry, will showcase the latest developments in Content Exch...
16/10/2026
Boston Conservatory Wind Ensemble Presents America at 250 The free event, taking place at Samuel Adams Park at Faneuil Hall, features a program of inspiring A...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
ON Creative Visual Tech Provider has completed the audiovisual design and integration for Nubank Arte Lab, Brazil's largest permanent immersive art space. T...
16/10/2026
Beam Dynamics has appointed Brian Mauger as Regional Sales Manager, North America, strengthening its commercial team as the company expands across media, broadc...
16/10/2026
Secret Weapon Post Uses DaVinci Resolve Studio for Gregg Araki Films
Brie Clayton October 15, 2026
0 Comments
Remote post house delivers I Want Your ...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
16/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...