Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Random Position

  • Random Position

    Posted by Doug Tepe on May 27, 2011 at 8:10 pm

    Thanks in advance.
    I have over 100 images that I would like to place in random x,y,z space. Moving all of them could take some time. Is there a way to speed the process up?
    hail the cow

    Walter Soyka replied 15 years, 3 months ago 2 Members · 8 Replies
  • 8 Replies
  • Walter Soyka

    May 27, 2011 at 9:04 pm

    [Doug Tepe] “I have over 100 images that I would like to place in random x,y,z space. Moving all of them could take some time. Is there a way to speed the process up?”

    Step 1: Describe your problem on CreativeCOW.net.

    Step 2: Wait 45 minutes.

    Step 3: Alt-click the stopwatch on the position property of the first layer and enter the following expression (adjusting the values as necessary):
    seedRandom(index, true);
    [random(0,1920), random(0,1080), random(-1000,1000)]

    Step 4: Select the position property of your layer and click Edit > Copy Expression Only

    Step 5: Select all the layers you want to randomly position and click Edit > Paste.

    Going into a little more depth on the expression above, the first line defines how random numbers will be generated. Using index as the first parameter links the random number generation to the layer number, and using true as the second parameter makes the random number generation timeless, so only a single value will be generated and it will not change on every frame.

    The second line passes three numbers random numbers back the position property — one for x, one for y, one for z. The parameters for each call to the random function define the range of random numbers to generate — from 0 to 1920 for x, from 0 to 1080 for y, and from -1000 to 1000 for z.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Doug Tepe

    June 1, 2011 at 11:06 pm

    Hi Walter,
    This worked great.
    Is there away to tie these x,y,z random positions to individual sliders controls? This might sound strange but I would like to be able to tweek the randomness a little. If they are not pushed back on the z or distributed enough on the other axis then I have to start from scratch with new numbers. Or am I missing something?
    thanks
    Hail the cow

  • Walter Soyka

    June 2, 2011 at 2:32 am

    [Doug Tepe] “Is there away to tie these x,y,z random positions to individual sliders controls?”

    Sure — add a series of slider controls (MinX, MaxX, MinY, MaxY, MinZ, MaxZ). Replace the hard-coded numbers with pickwhips to each of the slider values — then you’ll be able to control (and even animate) the ranges.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Doug Tepe

    June 2, 2011 at 2:53 am

    Cool.
    I may have a follow up with a question.
    Hail the cow

  • Doug Tepe

    June 2, 2011 at 4:04 pm

    Hi Walter,
    Do I need to change the first script to something else? I don’t want to take up to much of your time.
    Is there a tutorial you might be able to direct me to? I have been messing with it all morning and can’t seem to figure it out. I looked for one last night and couldn’t find one to suit this problem.
    hail the cow

  • Walter Soyka

    June 2, 2011 at 4:41 pm

    There are other ways of arranging lots of layers in 3D space, with more control over their placement. You could use Particular to emit the photos; you could use the built-in Card Dance effect to arrange and animate them; you could use PlaneSpace to arrange the layers randomly, within your guidelines. You should be able to find tutorials on any of these three methods.

    The method I initially suggested was a quick and dirty way to get the layers positioned randomly, and tweaking these results will probably take more time than just “randomly” positioning them by hand. It’s probably not suitable to the degree of control you’re looking for.

    If you really want to proceed with the method I outlined, add 6 slider control effects to your layer and renaming them minX, maxX, minY, maxY, minZ, maxZ.

    Once those are in, look at this line:

    [random(0,1920), random(0,1080), random(-1000,1000)]

    Select the first number (0), then pickwhip to the value of minX. You’ll see the numerical value be replaced with some code referring to the slider. Select the second number (1920) and pickwhip to the value of maxX. Repeat for all the values to the corresponding sliders.

    Now, adjusting those sliders will control the range in which the item is randomly placed on all three axes. If you set the sliders to 0, 1920, 0, 1080, -1000, and 1000 respectively, you’ll be starting exactly where you were in the original expression. Tweak them to taste.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Doug Tepe

    June 2, 2011 at 6:06 pm

    You sir Rock. Thanks
    hail the cow

  • Walter Soyka

    June 2, 2011 at 7:22 pm

    You’re welcome, Doug — best of luck with your project.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

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