16 Replies Latest reply on Mar 12, 2018 12:48 AM by Mathias Moehl

# Move out from center

Hi There,  Someone last week helped me with this expression to get hundred little objects (molecules) to burst apart:

var slider =  thisComp.layer("Slider Control").effect("Slider")("Slider"); // pick-whip slider here

var endPosition = wiggle(0,5000); // or use any other method to calculate the desired final location

linear(slider, 0,100,value, endPosition)

The problem is that it's random, so they don't all leave the screen. I could increase the value (over 5000) but then they're traveling to far and too fast).

How can I use this expression to tell the "end position" to be, for example, "1000 pixels from the middle of the comp"  ?    So they all fly out from the center.

• ###### 1. Re: Move out from center

As I describe here, you can use the “Distribute Circle & Spiral iExpression” for that:

• ###### 2. Re: Move out from center

Hey Mathias!.. thanks again. You're right... you had told me this last week.

It isn't clear on the AE Scripts site:   which bundle do I need to purchase that contains the :

# Distribute 2D Circle and Spiral Expression

• ###### 3. Re: Move out from center

wait ... just found it.   It's the "Layer Placement" bundle.   thanks again

• ###### 4. Re: Move out from center

Hi Andrew,

yes, it is part of the "Layer Placement Bundle" (and the "Full Bundle").

Cheers,

Mathias

• ###### 5. Re: Move out from center

Hi Mathias,

Maybe this is not what I need. I just watched most of the tutorial, and it shows all the layers in a circle. But my starting point is a random scattering of layers (see attached) ... 280 layers! ... From here in need them to fly away from the center.

• ###### 6. Re: Move out from center

Play around with this:

minSpd = 500;

maxSpd = 1500;

seedRandom(index,true);

spd = random(minSpd,maxSpd);

angle = random(Math.PI*2);

t = time-inPoint;

value + t*spd*[Math.cos(angle),Math.sin(angle)]

Dan

• ###### 7. Re: Move out from center

Thanks Dan!  Mathias' expression might work... I'm trying it, but it's taking over 30 minutes to move each of the 300 layers into position!

As for what you sent ... where does this go?  Is this added to the original expression I posted at the beginning of this thread?

• ###### 8. Re: Move out from center

It would replace that one.

Dan

• ###### 9. Re: Move out from center

thanks! ... So I apply it to each layer (all 300!)  ... can I connect it to a slider so I can keyframe the movement outward?

• ###### 10. Re: Move out from center

Apply it to one layer, select that property, Edit > Copy Expression Only, select all the other layers, Edit > Paste

Dan

• ###### 11. Re: Move out from center

Thanks Dan! ... seems to work.  Same question:  ... can I connect it to a slider so I can keyframe the movement outward?

• ###### 12. Re: Move out from center

I guess you could tie minSpd and maxSpd to sliders. If you wanted to control when motion starts, you could trigger the movement with a marker on a control layer like this:

m = thisComp.layer("control").marker;

minSpd = 500;

maxSpd = 1500;

seedRandom(index,true);

spd = random(minSpd,maxSpd);

angle = random(Math.PI*2);

t = Math.max(0,time - m.key(1).time);

value + t*spd*[Math.cos(angle),Math.sin(angle)]

Dan

• ###### 13. Re: Move out from center

Thanks again!  I'm getting a "this property has no keyframe number 1"  error

• ###### 14. Re: Move out from center

Make sure the "control" layer has a marker.

For the iExpressions solution:

Yes, by default it places the layers in a circle around a fixed center. But there is a trick: If you enable the "use keyframe value as offset" parameter and set the center of the circle to (0,0) it will for each layer use its current position as "center of the circle" (i.e. use (0,0) + the keyframed position value as the center). That way each layer stays where it is but with the radius parameter can be moved away from that location. With the wiggle parameters you can increase randomness as needed.

• ###### 15. Re: Move out from center

Thanks Mathias!  ... I'd love to play around with this (I did purchase the expression), but it's very slow. It took over 30 minutes to add the expression to my 300 layers, every change takes another 30 minutes. The earlier expression you sent me (below) ... works much better ... but since the position is random, I can't get them all to leave the screen.

• ###### 16. Re: Move out from center

Hi Andrew,

yes, unfortunately Ae gets pretty slow with complex expressions on lots of layers. This Ciricle and Spiral iExpression is way more complex than the simple wiggle, hence it is slower. Maybe First test it with just 10 layers or so and when you are happy with the result apply it to the others?