Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions seedRandom issue

  • seedRandom issue

  • Emil Woodruffe

    July 27, 2009 at 11:56 am

    Hi everyone, I was trying to control a bunch of layers off a slider to randomly move in x,y,z using the seedRandom. I can get it to work being random (totally!) with this:

    a = random(-500,500);
    b = random(-500,500);
    c = random(-500,500);

    x = a*thisComp.layer(“Adjustment Layer 2”).effect(“x depth”)(“Slider”);
    y = b*thisComp.layer(“Adjustment Layer 2”).effect(“y depth”)(“Slider”);
    z = c*thisComp.layer(“Adjustment Layer 2”).effect(“z depth”)(“Slider”);

    [x,y,z]

    …………………

    but when I try to seedRandom (see below) I get an error. Can someone explain where I’ve gone wrong??? please…

    a = seedRandom(3,true);
    random(-500,500);

    b = seedRandom(2,true);
    random(-500,500);

    c = seedRandom(1,true);
    random(-500,500);

    x = a*thisComp.layer(“Adjustment Layer 2”).effect(“x depth”)(“Slider”);
    y = b*thisComp.layer(“Adjustment Layer 2”).effect(“y depth”)(“Slider”);
    z = c*thisComp.layer(“Adjustment Layer 2”).effect(“z depth”)(“Slider”);

    [x,y,z]

  • Dan Ebberts

    July 27, 2009 at 1:20 pm

    Try it like this:

    seedRandom(3,true);
    a = random(-500,500);

    seedRandom(2,true);
    b = random(-500,500);

    seedRandom(1,true);
    c = random(-500,500);

    x = a*thisComp.layer(“Adjustment Layer 2”).effect(“x depth”)(“Slider”);
    y = b*thisComp.layer(“Adjustment Layer 2”).effect(“y depth”)(“Slider”);
    z = c*thisComp.layer(“Adjustment Layer 2”).effect(“z depth”)(“Slider”);

    [x,y,z]

    But I think you could simplify it a bit (not tested, so watch for typos):

    seedRandom(index,true);
    pos = random([-500,-500,-500],[500,500,500]);

    x = pos[0]*thisComp.layer(“Adjustment Layer 2”).effect(“x depth”)(“Slider”);
    y = pos[1]*thisComp.layer(“Adjustment Layer 2”).effect(“y depth”)(“Slider”);
    z = pos[2]*thisComp.layer(“Adjustment Layer 2”).effect(“z depth”)(“Slider”);

    [x,y,z]

    Dan

  • Emil Woodruffe

    July 27, 2009 at 9:32 pm

    Thankyou Dan, this is great.
    I now understand the thought process a bit better.
    Cheers very much.

Viewing 1 - 3 of 3 posts

Log in to reply.

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