7 Replies Latest reply on Nov 26, 2007 9:36 PM by kglad

    Drawing a curved line w/ Actionscript

    n00ge
      I'm having a tough time trying to dynamically figure out what a control point should be between a start and end point. I would like to consistently get a soft curve between the two points. The ideal curve would look something like this:
      http://www.actionscript.org/resources/content_images/4/steps.gif

      My problem comes in when I need to figure out the math to get the control point (p1 in that graphic). I see a lot of code out there drawing a sine curve or something more detailed, but I'm getting lost when it's just one curve. Ideally, I think what I'm looking for is a function along these lines:
      Code:

      function drawCurvedLine(target_mc,startX,startY,endX,endY,curveAngle){
      ...
      }

      The "curveAngle" argument would be a degree like 30, 45, etc...

      If anybody can help, I would appreciate it greatly. If I'm not thinking about this correctly, let me know.