• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I attach multiple objects to a moving path?

Explorer ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

I'd like to attach all of these shapes to this moving white line. Any help would be appreciated! The green one you see attached I did with Trace Paths. But it doesn't work for multiple objects. Thank you in advance.  Screenshot 2024-06-19 at 10.07.14 PM.png

TOPICS
Expressions , How to , Scripting

Views

401

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

If I'm understanding what you want to do correctly you could create a null object, parent the objects to the null and then copy and paste positioning from the path into positioning on the null object

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

Hi Rob, What is the "pat"? Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

Just realized you meant "path", my apologies. In theory, what you suggested would work. But when I copy the path key frames into the Null position, it goes bonkers like this. Even the keyframes paste all bunched up. Screenshot 2024-06-19 at 10.35.10 PM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

Sorry for the typo. I meant "Path."

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

Any thought as to why the path isn't pasting correctly and making the timeline go nuts? Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

This tutorial has your solution - https://youtu.be/4-VCqLDDcNg

HTH


Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

Hi Roland, Thank you for sending. I saw this before posting. It's for repeating one asset. I need to add multiple. If you have any suggestions for multiple objects on the same animated path that would be super. Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

I've not watched the entire video but my thoughts are that with different layers and not just duplicated layers, the distrbution should still work. You have to ensure each layer has the required Expression. 

What issue(s) did you face when trying out the technique?


Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

If you have a shape layer with a path and a bunch of other consecutive layers that you want to distribute along the path, you can use a position expression like this, where you set firstLayerIndex to the layer index of the first layer to be distributed and lastLayerIndex to the layer index of the last layer to be distributed:

 

L = thisComp.layer("Shape Layer 1");
p = L.content("Shape 1").content("Path 1").path;
firstLayerIndex = 1;
lastLayerIndex = 5;
myPct = (index - firstLayerIndex)/(lastLayerIndex - firstLayerIndex);
L.toComp(p.pointOnPath(myPct))

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

Hi Dan, I've applied the code you suggested but it's not connecting. Can you please let me know where I've gone wrong in this screen shot? Thank you.Screenshot 2024-06-20 at 11.08.46 AM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

There's an extra line at the top of your expression that shouldn't be there. It looks like firstLayerIndex should be set to 3 (?). If there's only one layer getting distributed then I guess lastLayerIndex should also be set to 3. Where is the path exactly (maybe post another screen shot that shows the stroke layer twirled open to expose the path)? Also, the layers being distributed shouldn't be parented to anything.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

Hi Dan, My apologies. In the first screen I sent I was trying to keep things simple by only having 1 shape to attach to the path. In this one I've included a few shapes. It still isn't working. Any help would be super appreciated. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

LATEST

Try it this way:

L = thisComp.layer("Anim stroke 2");
p = L.content("Shape 1").content("Path 1").path;
firstLayerIndex = 3;
lastLayerIndex = 7;
d = lastLayerIndex - firstLayerIndex;
myPct = d == 0 ? 0 : (index - firstLayerIndex)/d;
L.toComp(p.pointOnPath(myPct))

If you get an error, please post the error message.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines