-
find Y value of path at specific X value
Hello,
Here is a simplified version of a composition I’m working on. There is a row of rectangles with a linear gradient on each of them running from top to bottom. Across this row is a path I have drawn. I would like to attach the y value of the middle of each gradient to the path where it crosses the middle of that rectangle.
I’ve almost achieved the result I want using .pointOnPath calculated at the percentage of the distance of the x position of the rectangle to the width of the composition, but this is actually too imprecise for my actual composition. Due to the curvature of my path that percentage along the path isn’t really lining up with the x position of each rectangle. What I want to do is find the exact y value of the path where it crosses the exact x value of each rectangle. Can you think of a way to do this?
<br class=”simplyweb-checked”>
Right now this is how I’m getting the y value for the middle of my gradient:
thisComp.layer(“Path”).transform.position[1] + thisComp.layer(“Path”).content(“Path 1”).path.pointOnPath((transform.xPosition / thisComp.width))[1]
<br class=”simplyweb-checked”>
Thank you!