ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

random frames without repeating

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Pablo Pereda
random frames without repeating
on Dec 3, 2008 at 7:23:27 pm

Hi!
I've got a jpg footage and I want to change randomly the order in wich the images apears in the comp. I need to see every image without repeating it and also asign them diferent durations (I mean showing them about a random number betwen 25-40 frames each)
I've tried using Dan's answer to this post (http://forums.creativecow.net/readpost/227/10813) but I'm afraid it isn't the solution.
The problem is that it's my first time with After Effects expressions and I don't know how to do it. (And I even don't know if it can be done with expressions)
Thanks for your help and contratulations for this site and also for the podcast!
Pablo.


Return to posts index


cowcowcowcowcow
Dan Ebberts
Re: random frames without repeating
on Dec 3, 2008 at 11:02:41 pm

Assuming that your images are sequenced 1 per frame (either as an image sequence, or in a precomp), a time remapping expression like this should do what you want:

n = 100; // number of images
minDur = 25;
maxDur = 40;

seedRandom(index,true);
images = [];

for(i = 0; i < n; i++){
images[i] = i;
}

for (i = 0; i < n; i++){
idx = i + Math.floor(random(images.length - i));
temp = images[i];
images[i] = images[idx];
images[idx] = temp;
}

dur = 0;
f = -1;
while (time >= dur*thisComp.frameDuration && f < images.length - 1){
f++;
dur += Math.floor(random(minDur,maxDur+1));
}
images[f]*thisComp.frameDuration

You'll need to adjust the first parameter to match the number of images in your sequence.

Dan



Return to posts index

Pablo Pereda
Re: random frames without repeating
on Dec 3, 2008 at 11:13:11 pm

Great! It's exactly what I wanted to do!
Thanks a lot!



Return to posts index


Bryan Clark
Re: random frames without repeating
on Jan 15, 2010 at 5:09:56 pm

I'm digging up an old one here...

Any idea why, when I try this in CS4, I get the following error?

After Effects warning: Expected: ;
Expression disabled.
Error occurred at line 9.


I know zilch about anything but the simplest expressions, but I tried randomly adding a ";" to line 9. Oddly enough, that didn't work ;)


Return to posts index

Ben Markus
Re: random frames without repeating
on Oct 26, 2012 at 10:59:11 pm

This tutorial explains how to use Photoshop and After Effects CS6 to create looping image sequences and includes a useful frame randomizing expression. Check it out here...

http://benmarkus.wordpress.com/2012/08/09/working-with-image-sequences-in-p...


Return to posts index

Miguel Coelho de Augustinis
Re: random frames without repeating
on Jun 20, 2017 at 8:24:08 pm

hello , why i got blank frames into my animation? i set the frames to right number of frames my comp has tks

n = 81; // number of images
minDur =06;
maxDur = 12;

seedRandom(index,true);
images = [];

for(i = 0; i &lt; n; i++){
images[i] = i;
}

for (i = 0; i &lt; n; i++){
idx = i + Math.floor(random(images.length - i));
temp = images[i];
images[i] = images[idx];
images[idx] = temp;
}

dur = 0;
f = 1;
while (time >= dur*thisComp.frameDuration && f &lt; images.length - 1){
f++;
dur += Math.floor(random(minDur,maxDur+1));
}
images[f]*thisComp.frameDuration


Return to posts index


Dan Ebberts
Re: random frames without repeating
on Jun 20, 2017 at 8:59:28 pm

Hard to say without seeing it.

Dan



Return to posts index

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