I have been searching for an answer to this question for weeks now and I simply can not figure this one out. I've asked a question about it on SO once already, and another question in Mathematics, and it seams that nobody is able to solve this. It seems like such a simple issue, and one that's been solved many times before, but I just can't seem to find a solid answer or anything that I can comprehend or understand.
I simply need to be able to pass in a cubic bezier curve (both anchor points and both control points) and an X position inside that curve, and have some equation spit out the corresponding Y position for the X position that I passed in. Could someone please explain this to me a bit? I've seen countless questions asking this same exact question, and I can not find a single comprehensible answer. I even read through source code and searched Apple docs and CSS docs and every example I can. I spent 20 minutes churning around each answer inside my head to see if I could glean anything off it, and I simply can't solve this. If you have some information to share with me or anything you could tell me to help me hone in on an answer it's greatly appreciated!
I've tried to accomplish something similar to this using t
, so I can pass in all the x or y values of a cubic bezier along with a value t
which is between 0 and 1 and have it spit out a corresponding X or Y value... But this simply doesn't give me the results that I expect, nor the results that I need. I read that it may be a good solution to try to solve for t
given an X position, but I have absolutely no idea how I would go about converting t
to X at all, and there are no decent recourses for this anywhere on the web.
I even read through the code of some websites which are used for creating cubic beziers to see how they solve it and they simply don't. They just use CSS' built-in transitions, and I can't find the source code for those anywhere on the internet.
I'm really desperate here. It's been days of non-stop research, and I initially started trying to solve this problem over a month ago. If I ever come to a conclusive answer I've promised myself that I'll publish a small article explaining how this is done and providing others with this information that seems to be so hard to find. I'm sorry that this question seems so lengthy and off-topic, but currently I'm just desperate for information. I will post a much more long-term-friendly version of this question to make sure that it remains "wiki-like", but for now I really just need an answer!
(If you provide an answer which includes any code, feel free to write the code in any language you'd like. It's the equation that I'm after, so I will simply re-write it in the language I need and that won't be a problem.)