Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects randomize z position

  • randomize z position

    Posted by Bill Chadwick on May 23, 2008 at 6:42 pm

    ok, so i’m trying to do a self assembling collage of sorts. i have about 160 layers, each representing a picture. i want it to begin with every layer occupying a different z-position. then i want them to come together at, ending at the same z position “0”. it’s proving difficult to change the z values manually.

    i want maybe 10% of the layers to be between z: 100 to 200 while the rest will rest between z: -100 to -900. how can i do this? i dunno if anyone’s seen ironman the movie, but i’m trying to get that effect you saw in the stark industries promo video at the awards ceremony.

    this thing’s taking an hour to render on a 2.66 quad core with lighting…lol.

    Brian Lynn replied 17 years, 12 months ago 4 Members · 6 Replies
  • 6 Replies
  • Simon Bonner

    May 23, 2008 at 7:04 pm

    Ok, maybe there’s a better way to do this with expressions, but you could just assemble the collage how you want it, set keyframes for position, then go back a few seconds and just adjust the Z position to where you want it pre-assembly. I imagine switching the camera to top view will make this easier, as will initially moving the layers in blocks (20 of ’em to 60, another 20 to 80, etc, then shifting them apart slightly).

    Simon Bonner

    youtube.com/simonsaysFX

  • Bill Chadwick

    May 23, 2008 at 7:14 pm

    yeah that’s what i did. i basically set a keyframe for every layer at the end of my animation to z=0 so everything’s assembled. but it’s the changing all 160 layers to different z values at the first keyframe that’s proving tough. it takes a while, and even then, the results aren’t as dramatic. like some values might be too close together so you have like dozens of pics close together moving in tandem, even though the effect i’m going for is to have them look like they’re all separate.

    oh well, i’ll keep plugging away i guess.

  • Darby Edelen

    May 23, 2008 at 7:20 pm

    This expression should help you:

    <code>
    if(numKeys >= 2){
    k1 = key(1).time; //first keyframe
    k2 = key(numKeys).time; //last keyframe
    seedRandom(index, true);
    b = random(0,10);
    if(b > 9) z = random(100, 200);
    else z = random(-900, -100);
    
    p = [value[0], value[1], value[2] - z];
    
    linear(time, k1, k2, p, value);
    }
    else value;
    <code>

    It’s not the prettiest code ever, but it should do what you want it to do. The layers will converge on whatever their ‘value’ is. Also, they will only move in a straight line. You can change the last ‘linear’ to ‘ease’ and it will ease in and out, but the spatial interpolation will still be linear.

    Darby Edelen
    Lead Designer
    Left Coast Digital
    Santa Cruz, CA

  • Bill Chadwick

    May 23, 2008 at 7:34 pm

    awesome, but i’m still a newbie with after effects. how do i implement this expression on all 160 layers? select all and then alt+click position and paste the code doesn’t work? and do i need to set the keyframes? i see k1 and k2, but i didn’t know i can treat keyframes as vars.

  • Darby Edelen

    May 23, 2008 at 9:06 pm

    You need to have two keyframes on the position property, then Edit > Copy Expression Only and paste it onto the 160 layers.

    Darby Edelen
    Lead Designer
    Left Coast Digital
    Santa Cruz, CA

  • Brian Lynn

    May 24, 2008 at 12:55 am

    Just wondering… Can’t you use Card Wipe for this?

    If I understand what you are trying to do, it sounds like something I’ve done in the past. Card Wipe will require some finesse on the front end, you will have to assemble your images into one large graphic. Use Card Wipe to split the large image layer into smaller peices and use the Z controls for Card Wipe to send parts of the layer into Z space. Animate the settings back to 0 and viola! The Layer re-assembles properly with very little effort…

    Not sure this works for you… But if you’re trying what I think you’re trying it could save you a lot of time keyframing settings on one layer instead of 160 of them!

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