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?
Right now this is how I’m getting the y value for the middle of my gradient:
Hi Whitney. I think this should work better. It’s not 100% accurate, but more accurate than before. Basically, it checks for every percent if it passed the center of the current rectangle. When it passed, it returns the value. It will work bad if you have loops in your shape, but if it is similar to the example, it should work