Sony Pixel Power calrec Sony

Random Fixed Color Expression

25/06/2022

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
LINK: https://creativecow.net/random-fixed-color-expression/...
See more stories from creativecow

Most recent headlines

05/01/2027

Worlds first 802.15.4ab-UWB chip verified by Calterah and Rohde & Schwarz to be demoed at CES 2026

Worlds first 802.15.4ab-UWB chip verified by Calterah and Rohde & Schwarz to be ...

01/06/2026

Dolby Sets the New Standard for Premium Entertainment at CES 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 Flex LTS Delivers Smarter Search, Faster Editing, and an AI-Ready Foundation for Modern Media

Dalet, a leading technology and service provider for media-rich organizations, t...

01/05/2026

NBCUniversal's Peacock to Be First Streamer to Integrate Dolby's Full Suite of Premium Picture and Sound Innovations

January 5 2026, 18:30 (PST) NBCUniversal's Peacock to Be First Streamer to ...

01/04/2026

DOLBY AND DOUYIN EMPOWER THE NEXT GENERATON OF CREATORS WITH DOLBY VISION

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...

21/03/2026

Survey: Fans Prefer Sports on Broadcast Over Streaming

Share Copy link Facebook X Linkedin Bluesky Email...

21/03/2026

Graham Promotes Stephanie Slagle to VP, CRO & GM of WDIV Local 4

Share Copy link Facebook X Linkedin Bluesky Email...

21/03/2026

Study: Repurposed Traditional TV Ads for CTV Is a Missed Opportunity

Share Copy link Facebook X Linkedin Bluesky Email...

21/03/2026

Carr Backs Trump Army/Navy Game Executive Order

Share Copy link Facebook X Linkedin Bluesky Email...

21/03/2026

Opponents File Emergency FCC Petition to Block Nexstar/Tegna Merger

Share Copy link Facebook X Linkedin Bluesky Email...

21/03/2026

Eight States Ask for Court to Stop Nexstar/Tegna Merger

Share Copy link Facebook X Linkedin Bluesky Email...

21/03/2026

Cine Gear Connect NY Ramps Up for March 28 - 2026

Cine Gear Connect NY, presented by Universal Production Services, is filling in the slate for a full day of panels, peers, learning the latest, and mixing it up...

21/03/2026

Studio Technologies Debuts New StudioComm System at NAB 2026

Studio Technologies Debuts New StudioComm System at NAB 2026 Brie Clayton March 20, 2026 0 Comments StudioComm Model 794 Central Controller and Model ...

21/03/2026

Restoration Christian Fellowship Captures Worship Music Videos with PYXIS 12K

Restoration Christian Fellowship Captures Worship Music Videos with PYXIS 12K Brie Clayton March 20, 2026 0 Comments PYXIS' open gate provides cre...

20/03/2026

NAB 2026: Net Insight unveils Market-Leading JPEG XS at Scale for Live IP Media Production

Net Insight will introduce a JPEG XS solution for full IP environments at NAB Sh...

20/03/2026

NAB 2026: LTN and Harmonic Expand Partnership to Support FAST Growth and C-Band Migration

LTN has expanded its technology partnership with Harmonic ahead of the FCC's...

20/03/2026

NAB 2026: Solid State Logic to Preview SSL Live V6.2 with New SolidPitch Effect and Major Workflow Enhancements

Solid State Logic will preview SSL Live V6.2 at NAB Show, booth C6907. The softw...

20/03/2026

NAB 2026: Fujifilm Announces Availability of FUJINON UA22x4.8BERD 4K Broadcast Zoom Lens

FUJIFILM North America Corporation's Optical Devices Division has announced ...

20/03/2026

NAB 2026: Fujifilm Announces Development of FUJINON UA16x4BERD, UA30x7.3BERD, and UA94x8.7BESM 4K Broadcast Zooms

FUJIFILM North America Corporation's Optical Devices Division has announced ...

20/03/2026

TrueVisions NOW Chooses Bitmovin's Observability

TrueVisions NOW, a streaming platform in Thailand and part of the TrueVisions Group, has selected Bitmovin's Observability product for real-time video analy...

20/03/2026

Marquee Sports Network Expands Distribution to Hulu + Live TV, Prime Video

Marquee Sports Network has announced distribution agreements with Hulu + Live TV and Prime Video ahead of the 2026 MLB season. Marquee Sports Network is now av...

20/03/2026

NAB 2026: Software-Defined, AI-Powered Workflow Tells the Story of the New FOR-A America

FOR-A will exhibit software-defined and AI-driven solutions at NAB Show 2026, bo...

20/03/2026

TNA Wrestling and Eurosport India Announce New Multi-Year Exclusive Programming Agreement

TNA Wrestling and Eurosport India have entered into a multi-year exclusive progr...

20/03/2026

GameTime Productions Expands Technical Vision for Athletes Unlimited Basketball in Nashville

When Athletes Unlimited brought its professional women's basketball season t...

20/03/2026

Calrec Craft Interview with Senior Broadcast Audio A1 Engineer and Music Director Rick Bernier

In this craft interview, Rick Bernier reflects on a career that has taken him to...

20/03/2026

NAB 2026: IP Innovation, SoftwareBased Media Infrastructure & Dynamic Media Facility Workflows on Display for Lawo

Lawo will announce a new product ahead of NAB Show 2026 in Las Vegas, where it w...

20/03/2026

Ratings Roundup: 2026 World Baseball Classic is Most Watched WBC Telecast EVER with Over 10 Million Viewers

Ratings Roundup is a rundown of recent rating news and is derived from press rel...

20/03/2026

MLB Names Polymarket Exclusive Prediction Market Exchange Partner and Signs Agreement with CFTC to Establish Integrity Framework

Major League Baseball (MLB) has named Polymarket as its Official Prediction Mark...

20/03/2026

How Big Tech AI Will Lead Broadcast Innovation: Lessons from the Enterprise Market

With AI now the industry-wide priority, Big Tech companies are uniquely position...

20/03/2026

SVG GameDay, Ep. 8: Los Angeles Angels' Davin Maske - SoCal Baseball in Anaheim

In-venue and creative video staffers at the professional and collegiate level ha...

20/03/2026

Fanatics Studios, FOX Sports Focus on Cavalcade of Stars in Fanatics Flag Football Classic

Abundant player mics and RF and other ground-level cameras will be used to captu...

20/03/2026

ESPN Ramps Up Production Levels for NCAA Women's Tournament as Popularity, Viewership Skyrocket

Regional site will also receive big boost in production resources, including on-...

20/03/2026

Give Me the Backstory: Get to Know Addison Heimann, the Writer-Director of Touch Me

By Jessica Herndon One of the most exciting things about the Sundance Film Fest...

20/03/2026

Spotify Marks 5 Years of EQUAL With EQUAL: The Podcast' and Global Events

In 2021, we launched EQUAL, a program designed to address an industry reality that persists: Women artists, songwriters, and producers too often face fewer oppo...

20/03/2026

Spotify's BTS Music Quiz Celebrates ARIRANG' and Puts ARMY Knowledge to the Test

BTS' long-awaited fifth studio album, ARIRANG, is finally here. To celebrate...

20/03/2026

Spotify and Kenia Os Bring K de Karma' From Streaming to Stage With Fan-First Experiences

A new era for Kenia Os has arrived, and Spotify marked the moment by putting fan...

20/03/2026

Spotify y Kenia Os llevan K de Karma' del streaming al escenario con experiencias nicas para Top Fans

Una nueva era para Kenia Os ha llegado, y Spotify marc el momento poniendo a lo...

20/03/2026

Sound Magic launch Supreme Drums Orange

Combines sampling & physical modelling Sound Magic have announced the launch of a comprehensive virtual drum instrument that's been designed to cater to...

20/03/2026

Mix Rescue: Ian Shepherd Video

How much difference should mastering make? In our latest Mix Rescue feature, SOS Editor in Chief Sam Inglis revisits a project from back in 2019, carrying o...

20/03/2026

Feast for cycling fans as SBS extends road cycling broadcasts to include all Grand Tours and Monuments

Feast for cycling fans as SBS extends road cycling broadcasts to include all Gra...

20/03/2026

London Calling - When The Industry Convened to Help Streaming Find its MoJo

In this blog, Laura Rognoni reflects on key discussions from the Connected TV World Summit in London, where NAGRAVISION hosted a panel on content discovery and ...

20/03/2026

The Gauge: Poland | February 2026

After a series of increases, February brought the first slowdown in time spent in front of TV sets in a long time. While traditional television was losing viewi...

20/03/2026

Eric Wolff Joins Chyron as Director of Venues Sales, North America

Share Copy link Facebook X Linkedin Bluesky Email...

20/03/2026

Study: Broadcasters Rebuild Live Operations Around IP

Share Copy link Facebook X Linkedin Bluesky Email...

20/03/2026

Matt Conrad Acquires DSC Labs

Share Copy link Facebook X Linkedin Bluesky Email...

20/03/2026

Glensound celebrates its diamond anniversary at NAB Show

60 years of audio innovation, driven by the people who use it...

20/03/2026

FCC Approves Nexstar's Acquisition of Tegna

Share Copy link Facebook X Linkedin Bluesky Email...

20/03/2026

Icesi names Ronald David Reyes as the 2025 recipient of t...

Colombia's Icesi University and WSDG are proud to announce Ronald David Reyes as the recipient of the 2025 WSDG Excellence Scholarship, awarded to an outsta...

20/03/2026

Celebrating the greatest creators - One Battle After Ano...

Avid today celebrated the filmmakers, editors and sound teams that worked with Avid Media Composer and Pro Tools to create the vast majority of this year'...

20/03/2026

MRMC Names CP Communications Its Official U.S. Rental, Sales Partner

Share Copy link Facebook X Linkedin Bluesky Email...