Activity › Forums › Adobe After Effects Expressions › finding the position of a linear shape layer path
-
finding the position of a linear shape layer path
Posted by Victor Vazquez on September 14, 2013 at 10:36 pmHello,
Does anyone know if there’s an expression to bring up the position information for a linear shape layer path so I can use the information to add other elements as the line travels along the path?
Thanks,
Victor VazquezPeter Zeet replied 9 years, 11 months ago 3 Members · 14 Replies -
14 Replies
-
Dan Ebberts
September 15, 2013 at 12:58 amAre you talking about the path of the shape itself? You can select it, copy it, and paste it into the position of a null. That will give you a 2 second linear animation of the null around the path. To get the position value at 35%, for example, you could then do something like this:
pct = 35;
thisComp.layer(“Null 1”).transform.position.valueAtTime(2*pct/100);Dan
-
Victor Vazquez
September 15, 2013 at 2:55 amThanks for responding Dan. I made a portion of a line, created from a shape layer, animate by keyframing start and end percentages and changing the offset position from a trim paths animator. I want to be able to attach a null object to the head of the line animation as it moves forward. However, I’m not sure how I’m able to calculate the position as it moves forward in the line I drew in the shape layer. How would I go about attaching a null object to the head of the line animation as it moves forward?
Thanks,
Victor -
Dan Ebberts
September 15, 2013 at 6:52 amI’m not sure how the offset factors into it, but if you use the method I posted before, then add a 2nd null with this position expression:
pct = thisComp.layer(“Shape Layer 1”).content(“Shape 1”).content(“Trim Paths 1”).end;
thisComp.layer(“Null 1”).transform.position.valueAtTime(2*pct/100);Null 2 should follow the End value (with Offset set to zero). Play around with it–maybe you can get it to do what you need.
Dan
-
Victor Vazquez
September 15, 2013 at 7:36 amThanks for the response. When I put that expression into Null 2’s position it gives a warning so I put this expression:
pct = thisComp.layer(“Shape Layer 1”).content(“Trim Paths 1”).end;
thisComp.layer(“Null 1”).transform.position.valueAtTime(2*pct/100);But when I put that expression into Null 2’s position area, all that happens is Null 2 becomes linked to the same exact position as Null 1. Also, I set offset to 0.
Thanks,
Victor -
Dan Ebberts
September 15, 2013 at 5:16 pmNull 2 doesn’t follow the stroke around the path as you scrub the End value? It works like that for me.
Dan
-
Victor Vazquez
September 16, 2013 at 6:02 pmDan,
What were the expressions again for the position values that you used for each of the two null objects so that the null object followed the end value of the stroke?
Thanks,
Victor -
Dan Ebberts
September 16, 2013 at 6:17 pmThe first Null 1 doesn’t get an expression, just the path pasted into its position property. Null 2 gets this position expression:
pct = thisComp.layer(“Shape Layer 1”).content(“Shape 1”).content(“Trim Paths 1”).end;
thisComp.layer(“Null 1”).transform.position.valueAtTime(2*pct/100);Dan
-
Peter Zeet
May 30, 2016 at 11:36 pmHiya!
I’m curious if it’s possible to update this expression using the new sourceRectAtTime().width so we can get rid of the copy path as position to null?
I’m thinking about a ball following the end trim as on a video player, but making it work no matter the path’s width (and not using the position null trick)?
Reply to this Discussion! Login or Sign Up