How do I make an animation preset that creates a random seed every time?

New Here ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Hello all, I need to animate some photos falling on to a table (roughly 700 images) as a slideshow. I figured the best way to go about this (without relinquishing control to something like Windows Movie Maker) would be to create an animation preset in Ae and to apply that across each image, rather than making the animation by hand hundreds of times. If I knew how to make a preset, ideally I could open an image and apply it and then this 0.6s to 0.75s (timing isn't specific, only need one value for that) animation would apply:

  • picks a random point within the comp to serve as the starting point (ideally away from the upper middle third, but not required)
  • picks a random point within a 200px circle to serve as the ending point
  • animates opacity from 0-100%
  • rotates + or - 50 deg from start to finish
  • scales down roughly 20% from scale value before animation applied (not all of the images are the same resolution but only 5-7 images should be fully visible at any given moment, just no crazy scaling from like 150% to 20%)
  • possibly works off of index code so that images aren't generated right on top of each other

 

This is basically the old Vintage Prints photo slideshow screensaver from Mac. I know how to animate each of those bullet points by hand, but I want to learn how to make it random as well. I've seen videos that use slider controls but I don't need something I can manipulate, basically just an automation that would make animating 700+ images take far less time. If there's another program I could or should do this in, guidance towards that would also be greatly appreciated. Thanks all

TOPICS
Expressions , How to , Scripting

Views

56

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

The answer is complex expressions stored in the preset, but you have way too many requirements to make this work safely just with a preset, even more so since you may need multiple presets on multiple presets and applying them would still be a lot of work, given what you intend to do. There are also a lot of unanswered questions. E.g. how would you define the ending point and the radius around it? The bottom center of the comp? A custom Null object? Your description brings up several of these concerns. Anyway, this is typical stuff you'd use a script for simply due to the complexity, so start by checking AEScripts.com if something exists that covers (some of) your requirements.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

LATEST

The random seed can come from the layer number. You would start by setting the starting point as the layer in point, then use an interpolation method to generate the movement. I would start with position, then use the same approach to animate opacity and rotation. You can use sourceRectAtTime() to get the height and width of any layer and add that dimension to the top of the composition to get a starting point. The calculations are pretty straightforward if you are working with 2D layers. If you are working with 3D layers, you'll need to have a camera in the scene, know the focal length and point of interest, and the distance of the falling layer from the camera. You could generate a random multiplier for position and rotation, 

 

The simplest would be opacity. Here's an expression that animates opacity from 0 to 100% over ten frames starting at the layer in-point.

 

 

 

t = time - inPoint;
tMin = 0;
tMax = 10 * thisComp.frameDuration;
value1 = 0;
value2 = 100;
linear(t, tMin, tMax, value1, value2)

 

 

 

This will set a random starting position in the middle 1/3 of the comp width and just out of the frame and move them down to up to 200 pixels below the comp center.

 

 

 

seedRandom(index, true);
cntr = thisComp.width / 2;
span = thisComp.width / 6;
x1 = gaussRandom(cntr-span, cntr + span);
// new random seed
seedRandom(index + 1, true);
x2 = gaussRandom(x1 - 200, x1 + 200);
t = time - inPoint;
tMin = 0;
tMax = 30 * thisComp.frameDuration;
x = ease(t, tMin, tMax, x1, x2);
// move y
y1 = - thisLayer.sourceRectAtTime().height/2;
y2 = gaussRandom(0, 200) + thisComp.height/2;
y = easeIn(t, tMin, tMax, y1, y2);
[x, y]

 

 

 

 You could also use random values for start time (t in the expression), so you would not have to sequence the layers. You could also compensate for scale by multiplying thisLayer.sourceRectAtTime().height / 2 by scale[1] I .01. 

 

That might get you started. gaussRandom() generates a more bell-shaped pattern than just random. Setting seed to True makes the random number generator create only one value instead of a new one for every frame.

 

I hope this helps. I don't have time to figure out the formula for 3D layers, but it would be based on the same idea, just compensated for camera position, angle of view (focal length), and distance from the camera. 

 

One more thing to think about. If you have 700 layers and you start each layer one frame after the next, it's going to take 700 frames or about 25 seconds just to start all of the layers falling down. Rendering 700 3D layers with motion blur might also be a bit of a problem unless they are very small. 

 

A better approach may be to use a particle system like Particular and sequence your 700 images in a comp, one image per frame, and then have the particle system (Particular) spit out images randomly. You could create a cascade of falling images with just two or 3 layers. 

 

Here's an old Red Giant tutorial from 2017 that shows the basic workflow.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines