FORUMS: list search recent posts

How can I figure out the legnth of a path.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Scalzo
How can I figure out the legnth of a path.
on Mar 16, 2015 at 4:36:02 pm

The problem I'm having is I'm animating a stroke on with trim paths (which is measured in percentage of completion), and have a text layer writing it on with the path options. The First margin property is measured by length of the path. I plugged in a slider temporarily to adjust this value to re synchronize them after moving the path around. I would much prefer to somehow read the length of the path with another expression so it stays lined up as I adjust the path.


Return to posts index

Dan Ebberts
Re: How can I figure out the legnth of a path.
on Mar 16, 2015 at 5:44:29 pm

I'm not sure if this helps, but it's the only thing I can think of. If you copy the path and paste it into the position property of a null, the null will trace out the path at a constant speed over a two second period. So if you have a slider controlling the percentage, you can convert that to pixels traveled with something like this:

pct = effect("Slider Control")("Slider")/100;
thisComp.layer("Null 1").position.speedAtTime(0)*2*pct;

Dan



Return to posts index

Chris Scalzo
Re: How can I figure out the legnth of a path.
on Mar 16, 2015 at 6:29:30 pm

Thank you for the quick response. I spend around two hours searching for a quick solution. What I have now would probably be easier to manipulate for my current needs. I saw a response you made on paths to someone else stating there is little you can read with expressions on a path. I am running 2014.1.1 and was hoping this would have been updated in 2014.1.2 like the text bounds thing. Anyway, thanks again. I have much respect for your content on creativecow. :-)


Return to posts index


Charlie Leroy
Re: How can I figure out the legnth of a path.
on Mar 17, 2015 at 3:50:11 pm
Last Edited By Charlie Leroy on Mar 17, 2015 at 3:53:05 pm

Hello Chris,
If I understood correctly you have your stroke going from 0% to 100% and the text layer is following the "moving tip" of the stroke. is that correct?

if it is, then you can do this;
you know the First margin starts and the first margin finish

this should make your text starts and finish at the same time as the stroke appears ( if both the path and the stroke are the same obviously)
on the First margin value
//initial margin value
var x=1641;
//final margin value
var y= 3086;
//the End trim percentage
var z= thisComp.layer("Shape Layer 1").content("Trim Paths 1").end;
//cross product
value =z*(y-x)/100+x


hope it helps.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]