
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 ...
01/06/2026
January 6 2026, 05:30 (PST) Dolby Sets the New Standard for Premium Entertainment at CES 2026
Throughout the week, Dolby brings to life the latest innovatio...
02/05/2026
Dalet, a leading technology and service provider for media-rich organizations, t...
01/05/2026
January 5 2026, 18:30 (PST) NBCUniversal's Peacock to Be First Streamer to ...
01/04/2026
January 4 2026, 18:00 (PST) DOLBY AND DOUYIN EMPOWER THE NEXT GENERATON OF CREATORS WITH DOLBY VISION
Douyin Users Can Now Create And Share Videos With Stun...
26/02/2026
Final quarter revenues increase 7% year-on-year, with accelerating momentum in the second half
Space Services grows revenues by 6% year-on-year and records hig...
25/02/2026
With the Olympic Flag officially handed over to the organisers of the next Winter Games and the baton passed from Milano Cortina 2026 to French Alps 2030, the I...
25/02/2026
From a studio overlooking the Dolomites to workflows routed through Milan and into Salford, the BBC delivered a lean and mean operation for its Winter Games c...
25/02/2026
Warner Bros. Discovery (WBD) Sports is managing a huge network of channels acros...
25/02/2026
From its base in the northern Italian town of Cortina, Warner Bros. Discovery (W...
25/02/2026
In addition to 16:9-to-9:16 intelligent cropping for live video, Inference autom...
25/02/2026
Longtime rivals Floyd Money Mayweather Jr. (50-0, 27 KOs) and Manny PacMan P...
25/02/2026
The WNBA's Portland Fire and NWSL's Portland Thorns announce a groundbre...
25/02/2026
Multi-angle coverage, on-demand access to ultra-high-resolution video are provided for replays and clips across multiple distribution channels
The NHL and Cosm...
25/02/2026
The implementation standardizes an integrated workflow connecting ultra-high-res...
25/02/2026
Targeting a younger audience, creator-led network's Access Granted series hi...
25/02/2026
Alpha, the project's systems integrator, assisted in the workflow transformation
Tipping off the second half of the 2025-26 home schedule against the Houst...
25/02/2026
OCVIBE, the 100-acre mixed-use development transforming the area surrounding Hon...
25/02/2026
It's never been easier to customize your Spotify listening experience. Last year, we introduced more control over the way your playlist sounds, giving Premi...
25/02/2026
Hip-hop thrives on constant reinvention, with bold voices and fearless experimentation continually pushing the genre's boundaries. Every era brings new lead...
25/02/2026
L3Harris technicians recently completed a major mirror refurbishment for the U.S...
25/02/2026
This new offering helps solve for the need to move beyond traditional audience d...
25/02/2026
Gold-standard Gracenote content metadata will power Samsung's LLM-enabled entertainment search discovery experiences and more
NEW YORK February 25, 202...
25/02/2026
Afrobeats Icon Tiwa Savage Joins Forces with Berklee to Empower African Talent In collaboration with Berklee Global, the Tiwa Savage Music Foundation will hos...
25/02/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
25/02/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
25/02/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
25/02/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
25/02/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
25/02/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
25/02/2026
Arch Platform Technologies, a leading platform for creating and managing cloud workstation infrastructure, and Wacom, the world's leading manufacturer of in...
25/02/2026
Today, AWS is announcing AWS Elemental Inference, a fully managed AI service that automatically transforms and maximizes live and on-demand video broadcasts to ...
25/02/2026
As the only private television broadcaster serving Italian-speaking Switzerland, TeleTicino has long been committed to delivering authoritative, locally focused...
25/02/2026
In 2025, Magyar Telekom continued the consistent execution of its long-term stra...
25/02/2026
Joe Wilkinson and Joe Marler reunite for a tongue-in-cheek campaign exploring the hilarious extremes of modern loveWednesday 25 February 2026
Mix Tapes to Vide...
25/02/2026
Back to All News
Netflix Releases Exclusive Video and First Images From Brazil ...
25/02/2026
Harmonic's XOS Advanced Media Processor Leverages AI-Powered Encoding to Deliver Exceptional Video Quality to Alcom Customers SAN JOSE, Calif. - Feb. 25, 2...
24/02/2026
TNDV, a division of Live Media Group, delivered broadcast and live event product services for Passion 2026, marking the company's 17th year supporting the a...
24/02/2026
Ryan Schaber has had a front row seat to both the dynamics behind the Kraken's now-extended broadcast affiliation with TEGNA and its impact on the broader s...
24/02/2026
All Women's Sports Network (AWSN) announces the debut of women's professional boxing on its fast-growing television platform in partnership with Hall of...
24/02/2026
The NFL and StatusPRO, a sports entertainment and technology company that combines AI and performance data with emerging technology to create experiential conte...
24/02/2026
Pro League Network (PLN), a next-generation sports media and entertainment compa...
24/02/2026
Sportel Asia returns to Singapore for the first time since 2018 on March 24-25 and Agn s Marsan, Executive Director of SPORTEL Asia, says the return to Singapor...
24/02/2026
Join ARRI for a conversation and Q&A with Sports Cinematographer Domenick Satter...
24/02/2026
Veritone, Inc announces a renewal of its agreement with U.S. Soccer to license a...
24/02/2026
Commitment to innovation at network, conference, and institutional levels have i...
24/02/2026
The new RSN, which will produce 140+ games a year, arrives after the Braves exited Main Street Sports and FanDuel Sports Network earlier this month....
24/02/2026
CBS Sports and Concacaf today announced that CBS Sports will be the exclusive En...
24/02/2026
Official Venues Unveiled for Festival's Milestone Colorado Debut in 2027...
24/02/2026
Life needs music. So does the afterlife. That's why Spotify has partnered wi...