ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Any way to "keep" randomness when duplicating comp?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dan Gil
Any way to "keep" randomness when duplicating comp?
on Jul 2, 2010 at 5:09:36 pm

I'm using seedRandom (__,true) in a bunch of expressions to randomly move a bunch of objects.


The problem is, when I want to work on an alternate version, I duplicate the comp (to try some new lighting, for example) -- but then all my random numbers change!

And I have the camera positioned to 'catch' a couple of the objects!

I understand that the random seed is based NOT just on the value x in seedRandom(x,timeless) -- but also on the comp, layer, property...

Is there any way to get the randomness to 'persist' when I duplicate the comp??? To get the same random numbers in a different (duplicate) comp?

Thanks!

seedRandom(9,true); x=random(-1,1); y=random(-1,1);z=random(-1,1);
[ transform.position[0]+x*thisComp.layer("Control").effect("x")("Point")[0]+ Math.abs(x)/x * thisComp.layer("Control").effect("x")("Point")[1],
transform.position[1]+y*thisComp.layer("Control").effect("y")("Point")[0]+ Math.abs(y)/y * thisComp.layer("Control").effect("y")("Point")[1],
transform.position[2]+z*thisComp.layer("Control").effect("z")("Point")[0]+ Math.abs(z)/z * thisComp.layer("Control").effect("z")("Point")[1] ]


Return to posts index

Kevin Camp
Re: Any way to "keep" randomness when duplicating comp?
on Jul 2, 2010 at 9:48:19 pm

if you have the animations exactly like you want them, you could convert the expressions to keyframes from the animation menu...

if that process doesn't leave the expression, but disable the expression (which i think it may), copy the expression first, then convert it to keyframes, then paste the expression back in, but disable it.

then you'll still have the expression to go back to, if needed.

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Dan Gil
Re: Any way to "keep" randomness when duplicating comp?
on Jul 2, 2010 at 10:49:19 pm

That's a good idea! Forgot about that function.

Dan Ebberts also had a suggestion -- to use the wiggle function with 5th parameter set to 0 so that value doesn't change over time.

The randomness of the wiggle function does NOT vary when the comp is duped.

But it works differently, because it returns values based on the underlying property value ... not a defineable range like -1 to 1.

I'm trying to write a random function that returns values only towards the edges. That is, I want values from -400 to -200 and 200 to 400, but NOT -200 to 200.

Can anyone think of an elegant way to do this?

The only thing I came up with is to get a random number from -200 to 200, then ADD or SUBTRACT 200 based on the sign of the first number.

This was easier with the random() method -- not sure how to do it with wiggle().


Return to posts index


Filip Vandueren
Re: Any way to "keep" randomness when duplicating comp?
on Jul 4, 2010 at 1:27:32 pm

You would need to subtract the original value from the wiggle, to get just the random part, then do the same math on that.

For example:

w=wiggle(200,2,3,4,0);
ran=w-value;

edge_random= ran < 0 ? ran -200 : ran+200;

(haven't checked this code, just typing)



Return to posts index

Dan Gil
Re: Any way to "keep" randomness when duplicating comp?
on Jul 4, 2010 at 2:54:57 pm

sweet! thanks!


Return to posts index

Tim Fast
Re: Any way to "keep" randomness when duplicating comp?
on Jul 4, 2010 at 9:00:19 pm

I'm sorry for the off topic but I couldn't find a way to contact you Filip by other means. There is no "Contact" or "PM" button at your profile page or I'm just blind.

Anyhow, I saw your answer from year 2006(!) and the link in the answer doesn't work of course. I just wonder whether you still have the project. ;-) I don't have too much hope though.:-) I'm asking because I have the very same problem that the original poster in 2006 and I'd like to look at the result before I dive into layer copying. :-)


Return to posts index


Filip Vandueren
Re: Any way to "keep" randomness when duplicating comp?
on Jul 5, 2010 at 12:22:02 am

Answer in that thread



Return to posts index

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