Activity › Forums › Adobe After Effects › bendable line with balls
-
bendable line with balls
Posted by Clinton Gorman on February 6, 2023 at 2:45 pmHow can I attach shapes to a line and bend the line without distorting the shapes?
I’ve got a line that should have balls. When the line is bent, the balls should stay on the line and stay the same distance apart.
Here’s an image of what I’m trying to accomplish.
Clinton Gorman replied 1 year, 9 months ago 3 Members · 13 Replies -
13 Replies
-
Walter Soyka
February 6, 2023 at 7:21 pmThere’s a pointOnPath() expression that you can use to get, well, a point from a path. You pass a percentage as the input, and get back a point in the shape layer’s space.
I put together a quick sample project that shows this in action. I’m here to teach, so let me know what questions you have after you look it over.
-
Clinton Gorman
February 9, 2023 at 12:16 pmHi Walter, thank you for this! I didn’t see a notification from creative cow from some reason even though I’ve enabled notifications.
Anyways, I’m using ae 22.3, I can’t update because of problems I was having with older ae files for clients. Can you save for a previous version (22)?
I appreciate your help!
-
Walter Soyka
February 9, 2023 at 12:44 pm -
Clinton Gorman
February 9, 2023 at 1:27 pm -
Walter Soyka
February 9, 2023 at 2:08 pmThere are no keyframes or parents — the balls follow the line via .pointOnPath() expressions. If you animate the Path on the “Line” layer, you’ll see the balls follow along. There are also a few controls for the rig you can modify on the “CONTROL” layer.
-
Clinton Gorman
February 9, 2023 at 2:48 pmAhhh, that’s exactly what I was looking for. Wow, so nice.
I’m definitely going to have more questions, I’m learning AE on my own here using online tutorials.
Thank you Walter!
-
Clinton Gorman
February 9, 2023 at 4:11 pmI’ve duplicated the line with balls, created a new name for the line (Line2) and control layer (CONTROL 2). When I add balls, the balls stay on top of eachother. Do I only need to change the line layer name and control layer in the script for the ball? What am I missing?
var thisBall = thisLayer.name.split(” “)[1];
var numberOfBalls = thisComp.layer(“CONTROL 2”).effect(“Number of Balls”)(“Slider”);
var insetAmount = thisComp.layer(“CONTROL 2”).effect(“Line Inset Squeeze Percentage”)(“Slider”)/100;
var lineLayer = thisComp.layer(“Line2”);
var linePath = lineLayer.content(“Shape 1”).content(“Path 1”).path;
lineLayer.toComp(linePath.pointOnPath(linear(thisBall, 1, numberOfBalls, insetAmount, 1 – insetAmount)));
-
Walter Soyka
February 10, 2023 at 5:09 pmSorry, Clinton, I didn’t originally build the rig to support multiple layers in the same comp. I was using an expression to figure out what number the ball should be from the layer name.
Here’s a second version of the project. This uses more obvious controls on each ball layer to select the line it should look at, and identify which number it should be. I’ve also moved the controls onto the line layer, so you can have different properties per line instead of globally.
If you’re still kind of new to Ae, expressions can be pretty daunting, but if you have any questions on how they’re working, let me know and I’ll explain.
-
Clinton Gorman
February 15, 2023 at 7:43 pmThis is a creative solution and so simple!
The only issue in my specific situation, I need the balls to be on their own layers because the ends of the lines need to connect to the balls themselves. I’ll have lines of balls connecting to lines of balls.
Reply to this Discussion! Login or Sign Up