Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random speed for position of multiple layers. Is it possible?

  • Random speed for position of multiple layers. Is it possible?

    Posted by Robert Hoisan on February 24, 2011 at 12:08 pm

    Hi!

    Here it is: I have a bunch of layers,simple pieces of solids positioned randomly on the scene. All 3d. I have to reassemble this layers, just to bring them one close to each other. I will do the position key framing but i am interested to have different speeds on their trajectory. Like one layer is reaching the end position faster than other and so on, all randomly. I can manualy change the position speed in the graph but there are about 250 layers…

    There is any solution to assign random speeds to all my layers with an expression of some sort? To apply the expression to all the layers and result in having random different speed for the position keyframes?

    Thanks,

    Robert Hoisan
    Motion Graphics Artist

    Jake Grogan replied 15 years, 2 months ago 3 Members · 8 Replies
  • 8 Replies
  • Kevin Camp

    February 24, 2011 at 5:13 pm

    you can use an expression to create a random ‘start’ position for each layer and then have the expression interpolate from that random point to the final position….

    if that sounds like what you are after, give this a try:

    range = [200,200,200];
    seedRandom(index,true);
    start = random(value-range,value+range);
    if (numKeys >0){
    linear(time,inPoint,key(numKeys).time,start,value);
    }else{
    value;
    }

    the expression requires a single key frame that should be the final position and is used for timing of the animation.

    the range value is just xyz coordinates that define a volume that will be the range for the random dispersal. the volume is based on the current position, so [200,200,200] is a volume that is 200 pixels greater in all directions and 200 pixels less in all directions than the current position. change the range value as needed.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Robert Hoisan

    February 24, 2011 at 9:47 pm

    YES! Thank you, thank you, thank you! I appreciate your help, it is exactly what i needed.

    Robert Hoisan
    Motion Graphics Artist

  • Kevin Camp

    February 24, 2011 at 11:17 pm

    here’s a slight modification… just incase the random start position of a layer doesn’t give you the quite the position you want, this version should allow you to add an initial key frame to modify it’s start position:

    range = [200,200,200];
    seedRandom(index,true);
    start = random(valueAtTime(inPoint)-range,valueAtTime(inPoint)+range);
    if (numKeys > 0){
       linear(time,inPoint,key(numKeys).time,start,value);
    }else{
       value;
    }

    also, if you wanted the layers to ease into position, you would change linear() to ease(), like this:

    ease(time,inPoint,key(numKeys).time,start,value);

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Robert Hoisan

    February 24, 2011 at 11:20 pm

    Yes, i was looking for the ease feature. Thanks a lot 🙂

    Robert Hoisan
    Motion Graphics Artist

  • Robert Hoisan

    February 25, 2011 at 6:11 am

    What about rotation? What to change in the expression so i can apply it to x,y,z values of rotation also so that the layers start moving with random rotation values and when they reach that last position keyframe the x,y,z rotation values are set to 0?

    Thanks!

    Robert Hoisan
    Motion Graphics Artist

  • Kevin Camp

    February 25, 2011 at 3:16 pm

    i think you could use the same expression for a 3d layer’s orientation. the range values would then be in x,y,z degrees, something like:

    range = [360,360,360];

    if you wanted to modify it to be for single axis rotation, just set the range to a single value (rather than an array):

    range = 360;

    i can’t test it right now, but i’m pretty sure the rest of the expression should work fine either way.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Robert Hoisan

    February 25, 2011 at 3:51 pm

    Yes, it worked just fine on rotation too. Great advices 🙂

    Cheers!

    Robert Hoisan
    Motion Graphics Artist

  • Jake Grogan

    March 11, 2011 at 8:03 pm

    I am not to sure if you can do it with all layers together but you could do it to the layers separately.

    random(60,100) you can actually use whatever numbers you want. random*250 you can also use whatever number you want

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