Curve control point : Curve : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » Curve »

 

Curve control point


 
package{
  import flash.display.Sprite;
  import flash.display.*;
  public class Main extends Sprite{
    public function Main(){

        var canvas:Shape = new Shape(  );
        addChild(canvas);
        canvas.graphics.lineStyle(20x0000FF);
        curveThrough3Pts(canvas.graphics, 10010015050200100);

    }// Adapted from Robert Penner's drawCurve3Pts(  ) method
    public function curveThrough3Pts (g:Graphics,startX:Number, startY:Number,
                                      throughX:Number, throughY:Number,
                                      endX:Number, endY:Number) {
      var controlX:Number = (* throughX.5 (startX + endX);
      var controlY:Number = (* throughY.5 (startY + endY);
      g.moveTo(startX, startY);
      g.curveTo(controlX, controlY, endX, endY);
    }


  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» Curve