In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

ColorLine

ColorLine
Get Adobe Flash player
by ProjectNya 19 Oct 2010
    Embed
/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/y4N6
 */

////////////////////////////////////////////////////////////////////////////////
// ColorLine
////////////////////////////////////////////////////////////////////////////////

package {

    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.geom.Matrix;
    import flash.display.GradientType;
    import flash.display.SpreadMethod;
    import flash.display.InterpolationMethod;
    import flash.events.Event;
    import flash.filters.BlurFilter;

    [SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")]

    public class Main extends Sprite {
        private var line:Shape;
        private var grade:Number = 0;
        private var angle:Number = - 90;
        private static var radius:uint = 16;
        private static var radian:Number = Math.PI/180;

        public function Main() {
            //Wonderfl.capture_delay(1);
            init();
        }

        private function init():void {
            graphics.beginFill(0x000000);
            graphics.drawRect(0, 0, 465, 465);
            graphics.endFill();
            //
            line = new Shape();
            addChild(line);
            line.x = 32;
            line.y = 212;
            var colors:Array = [0xFF0000, 0xFFFF00, 0x00FF00, 0x00FFFF, 0x0000FF, 0xFF00FF, 0xFF0000];
            var alphas:Array = [1, 1, 1, 1, 1, 1, 1];
            var ratios:Array = [0, 42, 85, 127, 170, 212, 255];
            var matrix:Matrix = new Matrix();
            matrix.createGradientBox(400, 40, 0, 0, 0);
            line.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
            line.graphics.drawRect(0, 0, 400, 40);
            line.graphics.endFill();
            //
            line.filters = [new BlurFilter(grade, grade, 3)];
            addEventListener(Event.ENTER_FRAME, update, false, 0, true);
        }
        private function update(evt:Event):void {
            angle += 2;
            grade = radius*(Math.sin(angle*radian) + 1)/2;
            line.filters = [new BlurFilter(grade, grade, 3)];
        }
        
    }

}