forked from: flash on 2009-11-16

by yd_niku forked from flash on 2009-11-16 (diff: 21)
♥0 | Line 34 | Modified 2009-11-17 10:31:54 | MIT License
play

ActionScript3 source code

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

// forked from psyark's flash on 2009-11-16
package {
    import flash.display.Sprite;
    import flash.geom.Point;
    
    public class FlashTest extends Sprite {
        private var a:Point = new Point(100, 250);
        private var b:Point = new Point(200, 10);
        private var c:Point = new Point(400, 300);
        
        public function FlashTest() {
            graphics.lineStyle(1);
            graphics.moveTo(a.x, a.y);
            graphics.curveTo(b.x, b.y, c.x, c.y);
            
            graphics.lineStyle(0,0xFF0000);
            graphics.drawCircle(a.x, a.y, 2);
            graphics.drawCircle(b.x, b.y, 2);
            graphics.drawCircle(c.x, c.y, 2);
            graphics.moveTo(a.x, a.y);
            graphics.lineTo(b.x, b.y);
            graphics.lineTo(c.x, c.y);
            
            var color:uint = 0x00;
            var step:uint = 0x9;
            
            for (var t:Number=0; t<1; t+=0.04) {
                var d:Point = Point.interpolate(b, a, t);
                var e:Point = Point.interpolate(c, b, t);
                var f:Point = Point.interpolate(e, d, t);
                
                color += step;
                
                graphics.lineStyle(2, color<<16 );
                graphics.drawCircle(d.x, d.y, 1);
                graphics.drawCircle(e.x, e.y, 1);
            
                graphics.lineStyle(1, color<<16);
                graphics.drawCircle(f.x, f.y, 3);
            }
        }
    }
}