Random Fixed Color Expression
25/06/2022
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
04/08/2024
Dalet Appoints Santiago Solanas as CEO to Lead Next Era of Growth and Innovation
Dalet, a leading technology and service provider for media-rich organizations, is excited to announce Santiago Solanas as its new Chief Executive Officer (CEO)....
03/06/2024
Dalet and Veritone Reach Agreement to Distribute, Transact and Monetize Media Archives
Dalet, a leading technology and service provider for media-rich organizations, a...
28/04/2024
Mediahaus delivers the first SRT live-streaming sports production over 5G with URSA Broadcast G2
Mediahaus delivers the first SRT live-streaming sports production over 5G with U...
20/04/2024
PBS Kids Adds American Sign Language to Streaming Content
As part of a push to improve the accessibility of its content, PBS Kids has announced that it has integrated American Sign Language (ASL) interpretations into m...
20/04/2024
Survey: Concerns About Deep Fakes Spike As Election Approaches
SAN JOSE, Calif. Online security solution provider McAfee has released new research exploring the impact artificial intelligence (AI) and the rise of deepfakes ...
20/04/2024
FCC Sets April 25 Vote on Net Neutrality Rules
The Federal Communications Commission has announced the agenda for an Open Meeting on Thursday, April 25, 2024 that will include votes on Net Neutrality Rules a...
20/04/2024
Virtual Reality Becomes the New Production Reality
Virtual reality and its close relatives, such as extended reality, have been completely accepted into the workflow of high-end productions. Stepping into an LED...
20/04/2024
Video Games Round Out the Entertainment Package
Video Games Round Out the Entertainment Package Andy Marken April 19, 2024 0 Comments By this, I take it you think everybody is who they say they are...
20/04/2024
With Bears on the Clock, NBCU Local Chicago Plans Extensive NFL Draft Coverage
With the Bears picking first, NBCUniversal Local's properties in Chicago plan extensive coverage of the NFL draft next week....
20/04/2024
Fox Sports Hires Veteran Ad Sales Executives
Fox Sports said it hired two veteran advertising sales executives, with Jen Durda and Kathy Lydon both named VP....
20/04/2024
Daytime Emmys Announce Some Nominations Early
Daytime fans got a sneak peek at nominations for the 51st annual Daytime Emmys, with the National Academy of Television Arts and Sciences (NATAS) announcing the...
20/04/2024
DAZN Weighs in With Content Ahead of Haney-Garcia Fight
DAZN is launching its Run It Up, its first multi-sports original vodcast, or video podcast, and a set of micro-podcasts ahead of the Devin Haney-Ryan Garcia fig...
20/04/2024
Warner Bros. Discovery CEO David Zaslav Got 27% Raise to $49.7 Million in 2023
David Zaslav, CEO of troubled Warner Bros. Discovery, got a 27% increase in total compensation for 2023....
20/04/2024
April 19, 2024
New copper-catalyzed C-H activation strategy from Scripps Research Two-mode reactions inspired by human detox enzymes offer powerful new tools for drug discover...
19/04/2024
Thank You for visiting us at NAB 2024!
Thank You for visiting us at NAB 2024! Thank you for joining us at the ToolsOnAir booth during NAB Show 2024! We were delighted to showcase our latest inno...
19/04/2024
Stress Positions Mines Health Anxieties for Comedy
PARK CITY, UTAH - JANUARY 18: (L-R) John Early and Theda Hammel attend the 2024 Sundance Film Festival Stress Positions premiere at Library Center Theatre on ...
19/04/2024
Give Me the Backstory: Get to Know Julian Brave NoiseCat and Emily Kassie, the Filmmakers Behind Sugarcane
By Lucy Spicer One of the most exciting things about the Sundance Film Festival...
19/04/2024
Mexico City Watchlist: 7 Documentaries About Working in CDMX
Pictured: Midnight Family By Stephanie Ornelas A great way to get to know a city as culturally unique and rich as Mexico City is to listen to the stories tol...
19/04/2024
SNS Dominates NAB Show 2024 With Triple Win For MOD
St. Louis, MO - April 18, 2024 - Studio Network Solutions (SNS) announced today that MOD won three prestigious industry awards at NAB Show 2024 held this week i...
19/04/2024
How Spotify Approaches Safety With Sarah Hoyle, Global Head of Trust and Safety
Spotify's mission is to unlock the potential of human creativity by giving a million artists the opportunity to live off their art and billions of fans the ...
19/04/2024
Spotify and Taylor Swift Create a One-of-a-Kind Library To Celebrate THE TORTURED POETS DEPARTMENT'
It's a beautiful day to be a Swiftie. Today, Taylor Swift dropped her 11th s...
19/04/2024
L3Harris Announces Quarterly Dividend
MELBOURNE, Fla., April 19, 2024 - The Board of Directors of L3Harris Technologies (NYSE:LHX) declared a quarterly cash dividend of $1.16 per common share, payab...
19/04/2024
Intel Lays Out 8K Production, AI Tech Plans for Paris Olympics
PARIS Intel has announced that its plans for the Olympic and Paralympic Games Paris 2024 will include using artificial intelligence technology powered by Intel ...
19/04/2024
Tech Advances Boost Adoption of 8K Production
LAS VEGAS Technologists working on all aspects of the 8K media production chain offered an optimistic update at the 2024 NAB Show on the state of 8K in video pr...
19/04/2024
OpenDrives New Software-Defined Platform Atlas Wins 2024 NAB Show Product of the Year Award
OpenDrives New Software-Defined Platform Atlas Wins 2024 NAB Show Product of the...
19/04/2024
Grass Valley Showcases Next-Generation T3 Series 4K/HD Digital Recording and Playback for Venues and Stadiums
Grass Valley Showcases Next-Generation T3 Series 4K/HD Digital Recording and Pla...
19/04/2024
NiTRo's M-CUBE Studio Levels Up Esports Productions with AJA Gear
NiTRo's M-CUBE Studio Levels Up Esports Productions with AJA Gear Brie Clayton April 19, 2024 0 Comments Esports' rapid rise to popularity can...
19/04/2024
Blackmagic Design Announces DaVinci Resolve 19
Blackmagic Design Announces DaVinci Resolve 19 Brie Clayton April 19, 2024 0 Comments Major update adds new DaVinci Neural Engine AI tools, new color ...
19/04/2024
Sony Considering Bid to Acquire Paramount
Sony Pictures Entertainment is reportedly in talks with Apollo Global Management to make a bid to acquire Paramount which itself is currently discussing a merge...
19/04/2024
How 1185 Films created the VFX on new horror, All You Need Is Death
Simon Wilkinson, head of VFX at 1185 films, talks about the technology behind the newly-released horror By Matthew Corrigan Published: April 19, 2024 Simo...
19/04/2024
Could Sony be preparing a bid for Channel 5's parent company?
The global electronics company is said to be considering joining forces with investment firm Apollo Management to bid for Paramount Global By Jenny Priestley ...
19/04/2024
EBU report highlights contribution of free-to-air sport broadcasting
The report broke the economic footprint of EBU member sports broadcasting into three main areas By Matthew Corrigan Published: April 19, 2024 The report b...
19/04/2024
CBS Stations Launches CBS News California Investigates' Segments
CBS Stations has launched CBS News California Investigates , with Julie Watts named regional CBS California correspondent. She will uncover and raise awarenes...
19/04/2024
MediaCo Acquires Estrella Media's Spanish-Language Network, Content Assets
MediaCo Holding, which owns radio stations WQHT (Hot 97) and WBLS in New York, said it acquired Estrella Media's Spanish-language video, audio and digital c...
19/04/2024
Season 5 of The Witcher' Will Be Final One
Netflix has ordered season five of fantasy drama The Witcher, which will be the final season. Production has recently begun on season four, and the two remainin...
19/04/2024
DirecTV Stream To Carry Eight More The CW Affiliates
DirecTV Stream said it added eight more The CW affiliates to its lineup on Thursday....
19/04/2024
CBS Orders More Elsbeth'
CBS has renewed Elsbeth for the 2024-2025 season. The drama, with Carrie Preston in the lead role, debuted February 29....
19/04/2024
With Bears on the Clock. NBCU Local Chicago Plans Extensive NFL Draft Coverage
With the Bears picking first, NBCUniversal Local's properties in Chicago plan extensive coverage of the NFL draft next week....
19/04/2024
Comcast Launches NOW
PHILADELPHIA As government subsidies for broadband services come to an end, Comcast has launched NOW, a new product portfolio of lower-cost Internet, mobile and...
19/04/2024
DirecTV Stream Adds CW Affiliates
DirecTV Stream has added more local CW stations for its streaming customers in Boston, Charlotte, Cincinnati, Cleveland, Hartford-New Haven Conn., Phoenix, San ...
19/04/2024
MediaCo Acquires Estrella Media's Content and Digital Operations
NEW YORK & LOS ANGELES MediaCo Holding Inc. has announced that it has acquired all of Estrella Media's network, content, digital, and commercial operations....
19/04/2024
Adobe Launches New Adobe Express Mobile App with Firefly AI
SAN JOSE, Calif. Adobe has announced that the all-new Adobe Express mobile app is available to all users, bringing features powered by Adobe Firefly generative ...
19/04/2024
Netflix Adds 9.3M Subs in Q1
LOS GATOS, Calif. Netflix reported another blockbuster quarter by adding 9.33 million new subscribers in Q1, 2024 as global paid memberships hit 269.6 million, ...
19/04/2024
The Current State of the Industry and the Future Impact of AI
The Current State of the Industry and the Future Impact of AI Hillary Lewis April 18, 2024 0 Comments The Entertainment Industry: How did we get here ...
19/04/2024
After Effects Tutorial Text Blur Reveal
After Effects Tutorial Text Blur Reveal Andy Ford April 18, 2024 0 Comments Here's a way to do a quick blur reveal for your text layer. Start by...
19/04/2024
Hollyland Mars M1 Enhanced Wireless Transmitter / Receiver
Hollyland Mars M1 Enhanced Wireless Transmitter / Receiver Colin Smith April 18, 2024 0 Comments This tutorial shows the new wireless transmitter rece...
19/04/2024
Resolve Fusion: Writing Expressions with Lua
Resolve Fusion: Writing Expressions with Lua Simon Ubsdell April 18, 2024 0 Comments The answer to the very frequently-asked question: what is the pro...
19/04/2024
B+C,' Next TV' Announce Winners of Best of Show Awards at NAB Show
B+C and Next TV have announced the winners of Best of Show Awards for the 2024 NAB Show. The awards were judged by a panel of industry experts at the convention...
19/04/2024
Cate Blanchett Narrates Nature Series on Netflix
Cate Blanchett narrates the Netflix series Our Living World, which premieres April 17. The four-part series looks at the extraordinary creatures around the glob...
19/04/2024
For All Mankind' Spinoff Is in the Works at Apple TV Plus
Apple TV Plus has a spinoff of For All Mankind in the works. It is called Star City and details the cosmonauts, engineers and intelligence officers working behi...