Generating Random Motion Using AE 5.5's Expressions
26/07/2023
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
09/12/2024
Dalet Named an IDC Innovator in Media and Entertainment
Dalet, a leading technology and service provider for media-rich organizations, today announced that it has been named an IDC Innovator in the IDC Innovators: ...
27/11/2024
Give Me the Backstory: Get to Know Astrid Rondero and Fernanda Valadez, the Co-Directors of Sujo
By Jessica Herndon One of the most exciting things about the Sundance Film Fest...
27/11/2024
Dinner and a Movie: Katie Arthurs on Top End Wedding and Breakfast Burritos
The author watching a film with her mother and brother....
27/11/2024
Inside the Archives: Showcasing Sundance Talent in Oz and the Colosseum
Denzel Washington at the Piper-Heidsieck Tribute press conference at the 1993 Sundance Film Festival. Photo by Sandria Miller...
27/11/2024
Spotify Teams Up With UK Charity Youth Music To Support Grassroots Youth Spaces
Over the past decade in the U.K., financial constraints and shifting community resources have put many grassroots music spaces under increasing pressure. There ...
27/11/2024
Are You Wrapped-Ready? First Make Sure Your Spotify App Is Up-to-Date
Wrapped is almost here and Spotify is starting to drop hints at what this year's campaign is all about: the fans. To get ready for the big reveal, Spotify i...
27/11/2024
Find Restaurant Recommendations Based on Your Music Taste With Spotify, American Express, and Resy
Dining out for the vibes? You're not alone. According to Resy's 2024 Ret...
27/11/2024
L3Harris' Lou Speaight is a Finalist at Women in Defence UK Awards 2024
The Women in Defence U.K. awards ceremony celebrates the extraordinary contributions individuals and teams make to Defence....
27/11/2024
Tint Boosts Collaborative Workflows with EditShare Storage Across Gothenburg and Stockholm Facilities
Tint Boosts Collaborative Workflows with EditShare Storage Across Gothenburg and...
27/11/2024
Clear-Com Powers Communication at the 2024 Singapore Airlines Formula 1 Singapore...
eds3_5_jq(document).ready(function($) { $(#eds_sliderM519).chameleonSlider_2_1({...
27/11/2024
Nielsen launches activation with Advanced Audiences, enhancing digital campaign precision, reach and effectiveness across New Zealand
Auckland, November 26, 2024 Nielsen today announced the launch of Advanced Aud...
27/11/2024
Nielsen releases 2024 Food and Beverage Report, covering a decade of data on the sector's ad spend, media trends and consumer shifts in Australia
Report reveals ad spend of 100 occasional food & beverage brands over last 10 ye...
27/11/2024
Lynx Technik Adds Vincent Noyer as Director of Product Marketing
WEITERSTADT, Germany Broadcast TV equipment provider Lynx Technik has named Vincent Noyer as director of product marketing....
27/11/2024
NBCUniversal Works With Walmart to Bring Live Shopping to Live Sports
NEW YORK NBCUniversal and Walmart said they are bringing new shoppable experiences and measurement capabilities to live sports coverage. Kicking off on Thanksgi...
27/11/2024
Deadline extended for submissions to Best in Market 2024 Awards
The awards are open to any company that launched a product/service or brought new upgrades to an existing product/service in 2024 By TVBEurope Staff Publishe...
27/11/2024
Marc Allera to leave BT Group
In a nine year career with BT, Allera played a key role in the development of its joint venture with Warner Bros Discovery, TNT Sports By Matthew Corrigan Pu...
27/11/2024
Ross Video Hopes To BHAG Private Equity With Ambitious Strategy Shift
Ross Video has outlined a shift in its strategic approach and announced a significant financial target for 2030....
27/11/2024
Bending Spoons To Acquire Brightcove for $233 Million
BOSTON Brightcove said it has entered into a definitive agreement to be acquired by Bending Spoons in an all-cash transaction valued at about $233 million....
27/11/2024
Transmit, Wurl Partner on FAST Channel Ads
NEW YORK Advanced-advertising solutions provider Transmit and connected-TV tech company Wurl have struck a partnership that will bring Transmit's in-stream ...
27/11/2024
Prime Video Adds More FAST Channels for the Holidays
Amazon's Prime Video continues to bulk up its free, ad-supported streaming TV channels with the launch of holiday-themed channels and other services....
27/11/2024
Sinclair's Chris Ripley Lays Out ATSC 3.0 Challenges, Opportunities
HUNT VALLEY, Md. Earlier this month, Sinclair signed a memorandum of understanding with the Institute of Technology Bombay covering their collaboration on broad...
27/11/2024
Krotos Introduces the Creator Toolkit: Tailored Sound Effects for Content Creators
Krotos Introduces the Creator Toolkit: Tailored Sound Effects for Content Creato...
27/11/2024
First look revealed for third explosive instalment of Sky Original Gangs of London', coming 2025
First look revealed for third explosive instalment of Sky Original Gangs of Lon...
27/11/2024
The Summer Hikaru Died' Set to Bring Eerie Anime Thrills to Netflix
Back to All News The Summer Hikaru Died' Set to Bring Eerie Anime Thrills to NetflixPlay Video Play Video Entertainment 27 November 2024 GlobalJapan ...
27/11/2024
Thales Alenia Space to lead Carb-Chaser project, the first French constellation to monitor human-induced CO emissions
Facebook Twitter LinkedIn Cannes, November 27, 2024 - Thales Alenia Space,...
27/11/2024
RT Radio 1 Folk Awards Tickets on Sale
Awards on Wednesday 26th February 2025 in Vicar Street, Dublin #rtefolkawards | Tickets via Ticketmaster (link below) Tickets for the 7th RT Radio 1 Folk Awa...
27/11/2024
How RTX AI PCs Unlock AI Agents That Solve Complex Problems Autonomously With Generative AI
Editor's note: This post is part of the AI Decoded series, which demystifies...
26/11/2024
Afghan Reporter Wins Young Journalist of the Year 2024
A woman journalist from Afghanistan has been named Thomson Foundation's Young Journalist of the Year 2024. The journalist, who we are not naming for her ow...
26/11/2024
Audiobook Authors and Publishers Get a New Suite of Tools With the Launch of Spotify for Authors
Spotify's audiobook catalog brings more than 300,000 titles-and counting-to ...
26/11/2024
L3Harris in the UK Achieves Silver ERS Award Status
Jules Ball and Henry Watts, with the award being presented by Brigadier Adam Fraser-Hitchen ADC DL, Deputy Commander of 3rd UK Division....
26/11/2024
Reliable Power for Broadcast Sports Production
Steve ColeFor more than 14 years Steve Cole has been enjoying life in live broadcast, starting as a camera operator and shortly after, adding PTZ/remote camera ...
26/11/2024
Studio Technologies Introduces Model 352A and Model 354A...
Studio Technologies, manufacturer of high-quality audio, video, and fiber-optic solutions, presents the Model 352A and Model 354A Talk Stations. The units suppo...
26/11/2024
TASCAM Sonicview Recording and Mixing Consoles and SMPTE...
TASCAM, renowned for its versatile and adaptable audio solutions, today announced that its TASCAM Sonicview Digital Mixing Consoles and optional IF-ST2110 Expan...
26/11/2024
Blue Lucy takes on The Americas
London-based media technology business, Blue Lucy, has set up a US division of the company and appointed Dina Behar Hevert as VP Americas. The company's ent...
26/11/2024
Leader Experiences 2024 as Year of Ongoing Innovation in...
The American writer William Sydney Porter, better known as O. Henry, wrote of New York City in the early 1900s that It'll be a great place if they ever fin...
26/11/2024
AGILE CONTENT AND TISCALI TEAM UP TO LAUNCH THE TV SERVIC...
Agile Content joins forces with Tiscali to introduce a new platform in Italy, offering a wide range of premium content for all audiences. Agile Content, a Eur...
26/11/2024
Bulgarian Fund for Women made accessible using SubtitleNE...
For immediate release 26 November 2024, Sofia, Bulgaria Profuz Digital recently sponsored the Bulgarian Fund for Women's 20th Anniversary event by donat...
26/11/2024
Ikegami Sees Accelerating Adoption of IP and Mixed-Format...
Ikegami reports an accelerating migration to high-efficiency IP and mixed-format UHD/HD content creation throughout 2024. Product developments announced during ...
26/11/2024
CVP Announces the Second Belgian Production Technology Sh...
The premier event for cutting-edge production solutions, technologies, and industry insights returns to Brussels. CVP, one of Europe's leading resellers an...
26/11/2024
EMG-Gravity Media to deliver more than 350 hours coverage...
EMG / Gravity Media, a leading force in production and content, media services and facilities, today detailed EMG / Gravity Media's expanding broadcast and ...
26/11/2024
iZotope unveils Cascadia, an intelligent tape delay for clear and present mixes
iZotope unveils Cascadia, an intelligent tape delay for clear and present mixes Brie Clayton November 26, 2024 0 Comments Keep your mixes clear and fo...
26/11/2024
Award Winning Memoir of a Snail Finished in DaVinci Resolve Studio
Award Winning Memoir of a Snail Finished in DaVinci Resolve Studio Brie Clayton November 26, 2024 0 Comments DaVinci Resolve Studio used to create uni...
26/11/2024
Ross Video hopes to BHAG private equity with a shift in strategy and ambitious growth plans
Pulling back on innovation and growth doesn't fit the DNA of Ross Video. Pri...
26/11/2024
Bending Spoons dips into enterprise SaaS market with $233 million Brightcove acquisition
Italy-based Bending Spoons suite of digital technology products includes Evernot...
26/11/2024
Nielsen: Fox, Disney Gain Viewing Share in October
NEW YORK In the battle for viewing among the big TV and media players, Fox had a superb October, earning an 8.4% share of total TV viewing in Nielsen's Octo...
26/11/2024
FCC: Jan 1. Deadline to Implement Audio Description Rules in DMAs 101-110
WASHINGTON The Federal Communications Commission's Media Bureau has issued a reminder that stations in TV markets 101 to 110 must implement its new audio de...
26/11/2024
NBC News Now Expands Into Latin America
NEW YORK NBC News Now has expanded its international distribution into Latin America with launches in Mexico and Brazil on Samsung TV Plus....
26/11/2024
Scripps Sets up AI Strategy Team
CINCINNATI In a notable example of a broadcaster turning to artificial intelligence to improve operations and open up new business opportunities, E.W. Scripps h...
26/11/2024
Cablecast Community Media Bids Fond Farewell to Steve Israelsky
Cablecast Community Media Bids Fond Farewell to Steve Israelsky Brie Clayton November 25, 2024 0 Comments Steve sails into retirement following a colo...
26/11/2024
New Games, New Stakes: Squid Game' Season 2 Main Trailer and Key Art Round and Round' Unveiled
Back to All News New Games, New Stakes: Squid Game' Season 2 Main Trailer ...