works like a charm. if the curve moves really fast, there is some lag in
getting a line to connect to a point on the curve, but its not too bad
On 8/9/07, eric e. dolecki <[EMAIL PROTECTED]> wrote:
>
> you guys rock - i'll implement this soon™ and report back.
>
> doesn't matter which way the curve is i imagine (convex/concave)
>
> On 8/9/07, Zeh Fernando <[EMAIL PROTECTED]> wrote:
> >
> > > Quick question...
> > > I have a curveTo between points, but I'd like to get the x,y 1/2 way
> > through
> > > the curve, ON the curve. Googling for some code but haven't seen it
> > yet...
> > > I basically want to join another line to the midpoint of the curve,
> > and the
> > > curve is dynamically moving throughout
> >
> > A quick way is to use Penner's pointOnCurve...
> >
> > findPointOnCurve = function (p1x, p1y, cx, cy, p2x, p2y, t) {
> > return {x:p1x + t*(2*(1-t)*(cx-p1x) + t*(p2x - p1x)),
> > y:p1y + t*(2*(1-t)*(cy-p1y) + t*(p2y - p1y))};
> > };
> >
> > t is 0-1.
> >
> > It will give you some distortion on the position over the curve
> > depending on the angle, and desired position. If you use just halfway
> > (0.5) it'll work perfectly though.
> >
> > Same calculation and more information:
> > http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Quadratic_B.C3.A9zier_curves
> >
> >
> > Zeh
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
>
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com