Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Any way to “keep” randomness when duplicating comp?

  • Any way to “keep” randomness when duplicating comp?

    Posted by Ze’ev Gilad on July 2, 2010 at 5:09 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] ]

    Filip Vandueren replied 15 years, 10 months ago 4 Members · 6 Replies
  • 6 Replies
  • Kevin Camp

    July 2, 2010 at 9:48 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

  • Ze’ev Gilad

    July 2, 2010 at 10:49 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().

  • Filip Vandueren

    July 4, 2010 at 1:27 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)

  • Ze’ev Gilad

    July 4, 2010 at 2:54 pm

    sweet! thanks!

  • Tim Fast

    July 4, 2010 at 9:00 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. 🙂

  • Filip Vandueren

    July 5, 2010 at 12:22 am

    Answer in that thread

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy