On 16/03/2010 17:24, Glen Pike wrote:
p...@ipauland.com wrote:
I was recently asked if I could add some arrowheads to some actionscript
generated curves. I initially thought "Triangle pointing to end point", and that would be a great solution. I can place a MC at the end of the curve, but how can
I get the right angle to point it to?

Paul
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Hi,

If it's a 3 point Flash "Quadratic Bezier" curve with anchors and your arrows point like this <---------> your direction will be along the line from p1-p2 and p2-p3 or something like that?

e.g.

p1-----------------------p2------------------------------p3


so
graphics.moveTo(p1.x, p1.y);
graphics.curveTo(p2.x, p2.y, p3.x, p3.y);

v1 = p2 - p1;
v2 = p2 - p3;

calculate the angle using atan(v1.y / v1.x) and adjust for the "quadrant" you are in.


HTH

Glen
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Thanks for the suggestions - I shall give it a go.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to