Hi All
Great forum! I have a problem you might be able to help me with.
I have a curveTo – an anchor point and a control point.
Then I have a function that will return the x and y of a point along that curve if I give it a number as a percentage of the curve (0 to 1).
It looks like this, and works perfectly…
function drawOnCurve( interval:Number, x0,y0,x1,y1,x2,y2)
{
interval = Math.max( Math.min( 1, interval ), 0 );
var intervalSq:Number = interval * interval;
var difference:Number = 1 - interval;
var differenceSq:Number = difference * difference;
var _obj = new Object();
_obj.x = differenceSq * x0 + 2 * interval * difference * x1 + intervalSq * x2;
_obj.y = differenceSq * y0 + 2 * interval * difference * y1 + intervalSq * y2;
return _obj;
}
// x0,y0 are the start point, x1,y1 the control point and x2,y2 the final anchor point
But… I want to give it a _y value instead of a percentage (interval) and it return where on the curve that would intersect. Is that possible??
What r your thoughts, how should I do this?
Many Thanks
Nic