Page 1 of 1
ShapeLayer rectangle > trim path start end offset expression to adjust with rectangle size
Posted: December 6th, 2021, 7:50 am
please check image attached.
i have simple rectangle with stroke and trim path. When i adjust size of rectangle width or height then the start, end, offset of trim path shud adjust automatically to new rectangle size to retain original shape.
Re: ShapeLayer rectangle > trim path start end offset expression to adjust with rectangle size
Posted: December 7th, 2022, 12:39 pm
I've been trying to solve this same problem actually.
The issue is that there doesn't seem to be a way to link the start/end of the trim paths to either a specific segment or vertex of the path.
There are some extendscript functions that will be useful:
https://ae-expressions.docsforadobe.dev ... 0-5-t-time
PointOnPath(%,t) will return (x,y) values given a specific % of the path length, but I haven't been able to figure out if there's a way to do the reverse: return a % given a known coordinate on the path.
So far my best idea is to use the 'method of exhaustion', which is to feed 'pointOnPath()' increments of something like 0.1%, and then compare the resultant values to a specified vertex point, and if the difference is within a certain error threshold, then use that % of the arc-length as the value for the start/end.