Sony Pixel Power calrec Sony

Generating Random Motion Using AE 5.5's Expressions

26/07/2023

Generating Random Motion Using AE 5.5's Expressions

Dan Ebberts July 26, 2023

0 Comments

Originally published in 2002

In this tutorial, Dan Ebberts demonstrates a method of generating motion that is random in both time and space and allows you to quickly assemble a composition with a pleasantly fluid, chaotic movement.

Download Movie

Project File: .sit (currently unavailable)

The Problem:

The concept behind this tutorial came out of an online discussion. A fellow After Effects enthusiast was trying to come up with an expression to generate motion that was random in time and space. That is, target positions would be random as would the time it takes to get there. The problem that you encounter when trying to develop such an expression is that there just doesn't seem to be a good way to carry the value of variables forward in time from one frame to the next. Any variables that you define will be gone at the next frame. Consider the following example expression for opacity:

if (time = 0){

x = 10

}

else{

x = x 1

}

This works fine at the first frame. At the second frame you get an error because x is undefined. The expression doesn't remember that x was 10 on the previous frame. This becomes a serious limitation when you are trying to do something over a random amount of time because once you decide how long it should take, you need to check at every frame to see if you're done yet. Hard to do if you can't pass that value from one frame to the next.

Seed_random To The Rescue:

It turns out that you can get around this problem with the enhanced (for AE 5.5) seed_random function. This function allows you to establish a repeatable sequence of random numbers and regenerate them at will, just by restoring the seed to a previous value and then calling the random() function. This gives us a solution to the problem because even though we can't pass our random values from one frame to the next, we can recreate them using seed_random. Let's look at how seed_random works.

Open the project file and then open the basic comp . This is just a 640 480 comp with a 50 50 solid layer added. Select Solid 1 and reveal the position property. Alt-click (Option-click) on the stopwatch to activate the expression for this property. Enter the following expression:

[random(0,this_comp.width),random(0,this_comp.height)];

This will cause the square to jump to a random position in the comp. Preview the comp. You'll notice that the square jumps to a new position on every frame. Not very useful. Add a new line to the expression so that it now reads:

seed_random(1,true);

[random(0,this_comp.width),random(0,this_comp.height)];

Notice that again the square jumps to a random position but when you preview it stays there. This new behavior is due to a change that Adobe made to the seed_random function for AE 5.5. They've added a second parameter, that when set to true sets the random function so that random numbers generated don't depend on time. The random numbers depend on the layer number, the property number, the value of the first parameter in the seed_random call (the seed ), and the number of times the random function has been called. That means that the same expression will generate different random numbers in a different layer or property (later we will take advantage of this to quickly add complexity to our comp). Try changing the seed parameter to some other number. You'll notice that the square moves to a different location and stays there. Change the second parameter to false and notice that when you preview, the square jumps all over the place again.

Add a little more code to your expression so that it looks like this:

if (time < 1){

seed_random(1,true)

}

else{

seed_random(2,true)

}

[random(0,this_comp.width),random(0,this_comp.height)];

Now you'll notice that when you preview, the square stays at one location for the first second and then jumps to another location for the remainder of the comp.

So how do we use this new, more powerful seed_random function? Here's the key concept: With the second parameter set to true , for a given layer, property, and seed value, the random number you get when calling the random() function only depends on how many times you have called the function since setting the seed. That is, the first time you call random() after setting the seed you will get a particlar random number (let's call it x). The second call will generate a second random number (let's call this one y) and so on. But if you call seed_random again with the original seed, the sequence will start over. That is, the next random() call will regenerate the original random number (x in this case). Using a different seed value will cause a completely different sequence to be generated. Consider the following example:

seed_random(1,true); //set the seed value

A=random();

B=random();

C=random();

seed_random(1,true); //reset the seed to the same value

I=random();

J=random();

K=random();

seed_random(2,true) //new seed

Q=random();

R=random();

S=random();

seed_random(1,true); // reestablish original seed

X=random();

Y=random();

Z=random();

In this case, A,B, and C will all be different random numbers. However, A and I will be the same, B and J will be the same, and C and K will be the same because the seed has been reset (to 1 in this case) and the random sequence starts over. Q,R and S will be a new sequence of random numbers because the seed has been changed to 2. The sequence X,Y,Z will be the same as A,B,C and I,J,K because the seed has been set to 1 again. So we can return to a sequence of random numbers by reestablishing the seed value that generated those numbers.

How does this help us? To generate our random motion, at any given frame we need to know several things about the current segment of motio
LINK: https://creativecow.net/generating-random-motion-using-ae-5-5s-express...
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 ...

06/09/2026

Dolby and MagentaTV Bring Fans Closer to the FIFA World Cup 2026 in Germany with Dolby Vision and Dolby Atmos

June 9 2026, 23:00 (PDT) Dolby and MagentaTV Bring Fans Closer to the FIFA Worl...

04/08/2026

Dalet Announces Commercial Availability of Dalia, Bringing Media-Aware Agentic AI to Enterprise Productions

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

04/07/2026

Inside OneSoccers FIFA World Cup Ops: Canadas Soccer Network Goes Behind the Scenes for CanMNTs Historic Moment

When Canada qualified for the FIFA World Cup 2026, OneSoccer knew this wasn'...

04/07/2026

Rhodes to launch the MK8/80AE

Celebrates company's 80th anniversary Rhodes have recently revealed that they will be producing a limited run of electric pianos in celebration of their...

04/07/2026

Blackmagic Design Cameras Empower Youth Broadcasting Program

Blackmagic Design Cameras Empower Youth Broadcasting Program Brie Clayton July 3, 2026 0 Comments Blackmagic Pocket Cinema Camera 6K Pro and Blackmagi...

04/07/2026

iZotope Joins Boris FX

iZotope Joins Boris FX Boris Yamnitsky July 3, 2026 0 Comments iZotope, the team behind RX and Ozone, is joining Boris FX. A letter from founder Boris...

04/07/2026

Detective Conan: Fallen Angel of the Highway Opens in Dolby Cinemas Across Japan, Presented in Dolby Atmos and Dolby ...

April 7 2026, 19:00 (PDT) Detective Conan: Fallen Angel of the Highway Opens in...

03/07/2026

VSL reveal Synchron Brass (muted)

New bundle & three Single Packs Continuing to expand their already sizeable orchestral collection, VSL's latest release introduces three new Single Pack...

03/07/2026

London Symphony Orchestra upgrade LSO St Luke's

Venue installs new ATC-equipped control room LSO St Luke's, a unique music venue that also serves as the home of the London Symphony Orchestra, have rec...

03/07/2026

Caden Pearson appointed new Commissioning Editor for NITV

Caden Pearson appointed new Commissioning Editor for NITV 3 July, 2026 Media releases National Indigenous Television (NITV) has strengthened its commitment...

03/07/2026

2023

1 February 2023 SHARE Facebook Twitter Linkedin Email Munich, Germany, 1st February 2023: Cinegy GmbH, the premier provider of software technology for digit...

03/07/2026

Broadcast Solutions Acquires BFE

Share Copy link Facebook X Linkedin Bluesky Email...

03/07/2026

AdClarity Expands CTV Offering to 20 Countries

Share Copy link Facebook X Linkedin Bluesky Email...

03/07/2026

Mountain West Conference Launches SVOD Service With New Revenue Model

Share Copy link Facebook X Linkedin Bluesky Email...

03/07/2026

Death Star

Death Star Andy Marken July 2, 2026 0 Comments Look, I can't get involved. I've got work to do. It's not that I like the Empire; I hate i...

03/07/2026

Berklee's New Visual Identity: Honoring Our History, Building for What's Next

Berklee's New Visual Identity: Honoring Our History, Building for What's...

03/07/2026

July 01, 2026

Scripps Research scientists awarded $2M to advance global disease surveillance Two Gates Foundation grants will expand wastewater surveillance and AI-driven dis...

03/07/2026

July 02, 2026

Joan Pulupa joins Scripps Research faculty to study the organization of DNA in brain cells and its links to neurodegeneration Using smell-sensing neurons and ad...

02/07/2026

SVG Students To Watch: Abby Finke, University of Dayton

Entering her senior year, this hometown girl is paving a career in live sports production gaining experience in replay and audio and as a TD In the live-sports...

02/07/2026

SVG GameDay, Ep. 22: Winnipeg Jets Kyle Balharry - Going to Work in the Great White North

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

02/07/2026

BLAST Reports $133 Million in 2025 Revenue, Opens New York Headquarters

BLAST, a competitive entertainment company focused on esports, has announced more than $133 million in revenue for 2025, representing more than 40% year-over-ye...

02/07/2026

Riedel and SKAARHOJ Expand Collaboration with SimplyLive Integration

Riedel Communications has announced official SKAARHOJ panel support for SimplyLive production workflows, enabled through the SimplyLive 2.1 release. The integra...

02/07/2026

Czech Fire Rescue Service Deploys LiveU Video Transmission for Emergency Operations

The Fire Rescue Service of the Czech Republic has deployed LiveU video-over-bond...

02/07/2026

Gravity Media USA Appoints Brittney Boston as Head of Business Development

Gravity Media USA has announced the appointment of Brittney Boston as Head of Business Development, effective July 1, 2026. Based in Nashville, Tennessee, Bosto...

02/07/2026

TwelveLabs Raises $100 Million in Series B Funding

TwelveLabs, a video intelligence company, has announced $100 million in Series B funding co-led by NEA and NAVER Ventures, with participation from Amazon, Radic...

02/07/2026

Pro Padel League Announces Broadcast Partnership With USA Sports for 2026 Season

The Pro Padel League (PPL) has announced a broadcast partnership with USA Sports that will air five PPL championship matches on CNBC during the 2026 season, the...

02/07/2026

LiveLike Powers Eight FIFA World Cup 2026 Fan Engagement Activations Across Five Continents

LiveLike, a digital fan engagement platform, has announced eight confirmed FIFA ...

02/07/2026

InfoComm 2026: Cobalt Digitals blueCORE Wins Futures Best of Show Award

Cobalt Digital has received Future's Best of Show Award, presented by AV Technology at InfoComm 2026, for its blueCORE family of standalone signal processor...

02/07/2026

Synamedia Appoints Dr. Tzvi Gerstl as CEO

Synamedia has announced the appointment of Dr. Tzvi Gerstl as Chief Executive Officer. Paul Segre, who has served as CEO for the past six years, will transition...

02/07/2026

Esports World Cup 2026 Announces Expanded Sony Partnership for Paris Event

The Esports Foundation (EF) and Sony Group Corporation have announced an expanded collaboration for the Esports World Cup 2026 (EWC), taking place in Paris, Fra...

02/07/2026

Zee Entertainment Secures Exclusive Bundesliga Rights in India for Five Years

Zee Entertainment Enterprises Ltd. ( Z') has announced exclusive broadcast and digital rights for the Bundesliga in India for five years, beginning with the...

02/07/2026

All Hands on Deck: NBCU Comes Together to Produce Ultra-Complex Sail4th 250 Broadcast on July 4

An effort uniting News, Sports, Local, and Telemundo, the 50+-camera live produc...

02/07/2026

Release Rundown: What to Watch in July, From Gail Daughtry and the Celebrity Sex Pass to Murder 101

Zoey Deutch, John Slattery, Ken Marino, Miles Gutierrez-Riley, and Ben Wang appe...

02/07/2026

The Crow Hill Company introduce Brackish Pads

Stammering, stuttering, strangulated tones The Crow Hill Company's latest creation promises to be the most original sound set they've produced to d...

02/07/2026

Steinberg SpectraLayers 13 now available

A new era in unmixing and spectral editing The latest version of Steinberg's spectral audio-editing software has just arrived, building on the strength...

02/07/2026

Sine Machine from Melatonin

Aims to simplify additive synthesis Sine Machine is the debut launch from Melatonin, a Vienna-based developer who have spent the past six years creating wha...

02/07/2026

iZotope acquired by Boris FX

Products to remain fully active & supported Following the news of Native Instruments joining the inMusic brand line-up, Academy and Emmy Award-winning visua...

02/07/2026

GearExpo UK 2026

What you missed! Last weekend, Saturday 27 June 2026, saw the debut of Sound On Sounds new GearExpo UK event, the largest dedicated pro-audio event to take ...

02/07/2026

Imagine Communications Acquired by Lumine Group

Share Copy link Facebook X Linkedin Bluesky Email...

02/07/2026

Rise AV APAC Brings Mentoring Conversation to InfoComm As...

Following the successful launch of its inaugural APAC Mentoring Programme last month, the Rise AV APAC Regional Council will bring the conversation around mento...

02/07/2026

Blackmagic PYXIS 6K Used to Shoot Director Takahisa Zeze's Cry Out

Blackmagic PYXIS 6K Used to Shoot Director Takahisa Zeze's Cry Out Brie Clayton July 2, 2026 0 Comments Highly mobile camera supports tense and de...

02/07/2026

Broadcast Solutions acquires BFE, expanding its lead in European broadcast, media and communications infrastructure

Broadcast Solutions acquires BFE, expanding its lead in European broadcast, medi...

02/07/2026

Berklee Alum and Faculty Perform at Boston Public Library's 250th Anniversary Celebration of the Declaration of Independence

Berklee Alum and Faculty Perform at Boston Public Library's 250th Anniversar...

02/07/2026

Broadcast Solutions acquires BFE

Broadcast Solutions GmbH, a leading systems integrator and provider of innovative solutions for the broadcast media industry, is acquiring BFE Studio und Medien...

02/07/2026

LiveMode builds agile content ingest with Cinegy

Cinegy GmbH, the premier provider of software-defined television technology, has extended the ingest facility at leading Brazilian sports company LiveMode, work...

02/07/2026

Synamedia Appoints Dr Tzvi Gerstl CEO

Share Copy link Facebook X Linkedin Bluesky Email...

02/07/2026

Cobalt Digitals blueCORE Wins Futures Best of Show Award...

Standalone processors acknowledged for the innovation and value they bring to Pro AV Cobalt Digital, a leading designer and manufacturer of signal processing ...

02/07/2026

Synamedia Appoints Dr Tzvi Gerstl as CEO as Company Enter...

Synamedia announced today the appointment of Dr Tzvi Gerstl as Chief Executive Officer. Paul Segre, who has served as CEO for the past six years, will transitio...