Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
As I describe here, you can use the “Distribute Circle & Spiral iExpression” for that:
https://forums.adobe.com/thread/2460447
Copy link to clipboard
Copied
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 :
Copy link to clipboard
Copied
wait ... just found it. It's the "Layer Placement" bundle. thanks again
Copy link to clipboard
Copied
Hi Andrew,
yes, it is part of the "Layer Placement Bundle" (and the "Full Bundle").
Cheers,
Mathias
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
It would replace that one.
Dan
Copy link to clipboard
Copied
thanks! ... So I apply it to each layer (all 300!) ... can I connect it to a slider so I can keyframe the movement outward?
Copy link to clipboard
Copied
Apply it to one layer, select that property, Edit > Copy Expression Only, select all the other layers, Edit > Paste
Dan
Copy link to clipboard
Copied
Thanks Dan! ... seems to work. Same question: ... can I connect it to a slider so I can keyframe the movement outward?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks again! I'm getting a "this property has no keyframe number 1" error
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?