ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Picking random images

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tom Granberg
Picking random images
on Jul 13, 2017 at 3:51:42 pm

Is there a way, even convoluted, to have an expression pick a random image from either a comp, or whats available in the bin?


Return to posts index

Dan Ebberts
Re: Picking random images
on Jul 13, 2017 at 7:32:37 pm

And do what with it? To which property would this expression be applied?

Dan



Return to posts index

Tom Granberg
Re: Picking random images
on Jul 13, 2017 at 8:53:52 pm

Let's say I have a 400X400 footage file with a new face on each frame, footage is 4sec long (120faces).
I want to drop that in my comp, place it, duplicate over and over, and each copy is showing a different face.
Preferably without a repeat/duplicate face.


Return to posts index


Tom Granberg
Re: Picking random images
on Jul 13, 2017 at 8:57:32 pm

I've messed with this a little bit, and it works pretty good.

I've set the fr to 0.1 to allow for a long hold.
Then adjust the numFrames to 120 to account for the entire range of the footage.


fr = 12; // frame rate;
numFrames = 8;
seedRandom(index,true);
seg = Math.floor(time*fr);
f = Math.floor(random(numFrames));
for (i = 0; i < seg; i++)
f = (f + Math.floor(random(1,numFrames)))%numFrames;
framesToTime(f);


fr = 12; // frame rate;
numFrames = 8;
seedRandom(index,true);
seg = Math.floor(time*fr);
f = Math.floor(random(numFrames));
for (i = 0; i &lt; seg; i++)
f = (f + Math.floor(random(1,numFrames)))%numFrames;
framesToTime(f);


Return to posts index

Tom Granberg
Re: Picking random images
on Jul 13, 2017 at 8:58:35 pm

This is applied to the timeremap feature


Return to posts index

Tom Granberg
Re: Picking random images
on Jul 13, 2017 at 9:16:03 pm

While we are on this topic.
What is the best way to alter the above script to randomly pick a start point and play X amount of frames and then stop and hold?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]