Activity › Forums › Adobe After Effects Expressions › evenly disperse
-
evenly disperse
Posted by Dustin Ward on April 8, 2010 at 6:07 pmI have 15 separate objects in the shape of a perfect circle. I want all the objects to disperse evenly to encompass a larger circle. Any Ideas?
Thomas Tomchak replied 16 years ago 3 Members · 6 Replies -
6 Replies
-
Ben Rollason
April 8, 2010 at 6:51 pmIf it’s in 2D, which I guess it is, ‘cos you said circle not sphere…. how about
on the anchorPoint
circleRadius = 100; //the radius of your circle seedRandom(this.index, true); [random(circleRadius),value[1]]; //[random(circleRadius), value[1]]; //uncomment this for in a circle, instead of inside a circle
then on the z rotation:
seedRandom(this.index, true); random(360);
then set the position to the centre of your circle.
It’s a fairly simplistic method, but it should work. If you don’t want to move the anchorPoint, you need a bit more math. You could put…
circleCentre = [100,100]; //your circle centre seedRandom(this.index,true); circleRadius = random(100); //your circle radius //circleRadius = 100; //uncomment this if they should be in a circle rather than inside a circle! tRnd = degreesToRadians(random(360)); circleCentre + circleRadius*[Math.cos(tRnd), Math.sin(tRnd)];
on the position property.
If it is in 3D space, just put the z rotation expression on the y and x too.
-Ben.
-
Thomas Tomchak
May 18, 2010 at 5:06 pmHow would you alter this to work with the full raster of the screen. In my case I have a 3358×768 comp that I need to evenly spread 192 objects over in random order (names of countries). I was thinking about using a particle emitter but I’m thinking the client is going to want to move some around once she sees the final look, so I need the freedom to move them after the fact.
So I’ve already created 192 comps that have each country name writing on and need to evenly fill the screen. Any help would be appreciated. I could do it by hand, but don’t really want to 🙂
Also, I checked out your reel Ben and it’s very impressive. I may be able to use your services down the road for some projects. We do some graphics in house, but on occasion what we need to do is outside of what we’re capable of.
Thanks in advance for any assistance you can provide.
Tom
Thomas Tomchak
President, Edit Creations, Inc.
https://www.edit-creations.comEdit Blog
https://www.suitetake.com -
Ben Rollason
May 18, 2010 at 5:42 pmHi Thomas,
Thanks for the kind words! Drop me a line any time if you need an extra pair of hands on a project.
If I understand correctly what you’re trying to do, then bring all of your comps into one main comp. On one of the layers, set the position to [0,0] then type in the following:
seedRandom(this.index, true);
[random(thisComp.width), random(thisComp.height)] + value;
That will randomly distribute the layers, but you can adjust the position by changing the original position value. (it will get added to the randomly generated position). Be careful though. If you add layers or change the layer order, the positions will change. This is because the random number is based on the layer index. You could give each layer a Slider and manually set the value and use this to generate the random seed. Something like…
seedRandom(this.effect("manual random seed")("Slider"), true);
[random(thisComp.width), random(thisComp.height)] + value;
But that’s more work…nearly as much as setting them randomly!
If you’re working in 3D, the random z component would need to be arbitrary as a composition has no set depth. Ideally in 3D, you’d want to distibute the layers in a pyramid radiating out from the camera and this is a bit more complicated, but a box will usually do the trick, if the depth isn’t too major.
Once you’ve put the expression on one layer, copy the position attribute (select it and Ctrl-C / Cmd-C ). And paste it onto all the others. Select ’em all (just the layers will do – you don’t have to select the position property to paste) and Ctrl-V / Cmd-V.
You could also check out Lloyd Alvarez 3D layer distributor script… https://aescripts.com/3d-layer-distributor/
Loads of other good automation scripts over at aescripts too.
Best,
-Ben.
-
Thomas Tomchak
May 18, 2010 at 6:52 pmJust to clarify, the first expression that you outlined is to be applied to each of the layers?
Or just to the first one?
I’m a bit unclear on how all of the layers are effected by this one expression if it’s only applied in a single location.
Thomas Tomchak
President, Edit Creations, Inc.
https://www.edit-creations.comEdit Blog
https://www.suitetake.com -
Ben Rollason
May 18, 2010 at 6:59 pmYes… apply the expression and the position data to all of the layers. It’s important that each layer not only has the expression, but also the ‘pre-expression’ value of [0,0] because this value is added to the randomly generated one. That’s how you are able to adjust the random position manually after the event.
-Ben.
-
Thomas Tomchak
May 18, 2010 at 7:01 pmOK, that does make sense. Thanks.
I’ll let you know how it works out.
Thomas Tomchak
President, Edit Creations, Inc.
https://www.edit-creations.comEdit Blog
https://www.suitetake.com
Reply to this Discussion! Login or Sign Up