Activity › Forums › Adobe After Effects Expressions › Picking random images
-
Picking random images
Posted by Tom Granberg on July 13, 2017 at 3:51 pmIs there a way, even convoluted, to have an expression pick a random image from either a comp, or whats available in the bin?
Tom Granberg replied 9 years ago 2 Members · 5 Replies -
5 Replies
-
Dan Ebberts
July 13, 2017 at 7:32 pmAnd do what with it? To which property would this expression be applied?
Dan
-
Tom Granberg
July 13, 2017 at 8:53 pmLet’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. -
Tom Granberg
July 13, 2017 at 8:57 pmI’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 < seg; i++)
f = (f + Math.floor(random(1,numFrames)))%numFrames;
framesToTime(f); -
Tom Granberg
July 13, 2017 at 9:16 pmWhile 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?
Reply to this Discussion! Login or Sign Up