Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random positions

  • Posted by Jorge Lavín on September 21, 2011 at 4:20 pm

    Hey everyone.

    This is my firts question as I am new to After effects and found this forum.

    Well, I have a composition with many layers (more than 200 pics) I needed to spread them appart so I used this expression in each one:

    range = 10000;
    x = random(-range,range);
    y = random(-range,range);
    z = random(-range/2,range/2);
    [x,y,z];

    The thing is I want them to stay in that position, but I found that they change every frame. How can I resolve this?

    Thank you.

    range = 10000;
    x = random(-range,range);
    y = random(-range,range);
    z = random(-range/2,range/2);
    [x,y,z];

    Amy Young replied 9 years, 1 month ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    September 21, 2011 at 5:10 pm

    Just add this as the first line of the expression:

    seedRandom(index,true);

    Dan

  • Jorge Lavín

    September 21, 2011 at 10:01 pm

    Thanx Dan, it worked!

    Now I have another problem 😛

    hope someone can help me, what I want to do now is to convert the random values generated with constant numbers since I made some camera moves over the spreaded pics, saved the proyect and (I really dont remember if I closed it and opened it again) the values changed, I mean the pics are now on different locations.

    Thank you again

  • Dan Ebberts

    September 21, 2011 at 11:02 pm

    That will happen if you add new layers above the ones with the expression.

    You can always select the position property, and then Animation > Keyframe Assistant > Convert Expression to Keyframes. You can then delete the keyframes if you want.

    Dan

  • Jorge Lavín

    September 21, 2011 at 11:16 pm

    Thank u again Dan!

  • Amy Young

    April 15, 2017 at 9:40 pm

    Thanks Dan! Neato!

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