Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Find the postition of the End Point of a Trim Path

  • Find the postition of the End Point of a Trim Path

  • Jacob Roth

    July 24, 2019 at 4:18 pm

    Hi everyone.

    So I have a stroke with a trim path, and I’d like to attach a point control to the one end of the stroke as it moves along a trim path. Even better would be if the point control follows the end of the stroke even if I change the offset. Any ideas how I would accomplish this?

  • Dan Ebberts

    July 24, 2019 at 6:08 pm

    Something like this should work:

    L = thisComp.layer(“Shape Layer 1”);
    p = L.content(“Shape 1”).content(“Path 1”).path;
    offset = thisComp.layer(“Shape Layer 1”).content(“Shape 1”).content(“Trim Paths 1”).offset;
    pct = L.content(“Shape 1”).content(“Trim Paths 1”).end/100;
    offsetPct = (pct+ offset/360)%1;


  • Jacob Roth

    July 24, 2019 at 7:30 pm

    Works like a dream! Thanks Dan.

  • Elliot King

    April 23, 2021 at 2:38 pm

    Hi Dan. I am having a similar issue to Jacob at the moment.

    Are you suggesting here to apply this expression to the point control itself?

    Am trying to have a trim path stroke loop using an offset, expression linked to a slider, but also want a few shape layers to loop with the stroke. Have tried using create nulls from paths (trace null) in order to parents the shapes to the null but can’t seem to find a way to get my null to loop with the stroke offset, as I normally just expression link the null to the start or end point of the trim.

    Thank you in advance.

  • Dan Ebberts

    April 23, 2021 at 6:31 pm

    Actually, if you’re applying it to a point control, you’d want to change the last line to this:

Viewing 1 - 5 of 5 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy