CurveDrawing

by fakestar0826
♥0 | Line 34 | Modified 2011-01-16 18:54:40 | MIT License
play

ActionScript3 source code

/**
 * Copyright fakestar0826 ( http://wonderfl.net/user/fakestar0826 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6gKh
 */

package {
    import flash.display.GraphicsPathCommand;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        
        private var commands:Vector.<int> = new Vector.<int>();
        private var lineCommands:Vector.<int> = new Vector.<int>();
        private var data:Vector.<Number> = new Vector.<Number>();
        
        public function FlashTest() {
            // write as3 code here..
            
            data.push(200, 200);
            
            data.push(250, 100);
            data.push(300, 200);
            
            data.push(400, 250);
            data.push(300, 300);
            
            data.push(250, 400);
            data.push(200, 300);
            
            data.push(100, 250);
            data.push(200, 200);
            
            commands.push(GraphicsPathCommand.MOVE_TO);
            commands.push(GraphicsPathCommand.CURVE_TO);
            commands.push(GraphicsPathCommand.CURVE_TO);
            commands.push(GraphicsPathCommand.CURVE_TO);
            commands.push(GraphicsPathCommand.CURVE_TO);
            
            lineCommands.push(GraphicsPathCommand.MOVE_TO);
            lineCommands.push(GraphicsPathCommand.WIDE_LINE_TO);
            lineCommands.push(GraphicsPathCommand.WIDE_LINE_TO);
            lineCommands.push(GraphicsPathCommand.WIDE_LINE_TO);
            lineCommands.push(GraphicsPathCommand.WIDE_LINE_TO);
            
            graphics.lineStyle(0);
            graphics.drawPath(commands, data);
            
            graphics.lineStyle(0, 0x000000, 0.5);
            graphics.drawPath(lineCommands, data);
        }
    }
}

Forked