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.
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
Copy link to clipboard
Copied
Hi Rob, What is the "pat"? Thank you.
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.
Copy link to clipboard
Copied
Sorry for the typo. I meant "Path."
Copy link to clipboard
Copied
Any thought as to why the path isn't pasting correctly and making the timeline go nuts? Thank you.
Copy link to clipboard
Copied
This tutorial has your solution - https://youtu.be/4-VCqLDDcNg
HTH
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.
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?
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))
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.
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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.