forked from: flash on 2010-7-21

by _ueueueueue forked from flash on 2010-7-21 (diff: 3)
...
@author ue
♥0 | Line 76 | Modified 2010-07-21 16:19:21 | MIT License
play

ActionScript3 source code

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

// forked from _ueueueueue's flash on 2010-7-21
package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.ui.*;
    import frocessing.color.ColorHSV;
    
    [SWF(width=465,height=465,backgroundColor=0x0)]
    
    /**
     * ...
     * @author ue
     */
    
    public class Main extends Sprite 
    {
        private const INTERVAL:Number = 4;
        private var _num:int = 250;
        private var _lines:Array = [];
        
        public function Main():void 
        {
            for (var i:int = 0; i < _num; i++) 
            {
                var line:Line = new Line();
                line.color.h = i * 0.5;
                addChild(line);
                _lines.push(line);
            }
            
            addEventListener(Event.ENTER_FRAME, update);
        }
        
        private function update(e:Event):void 
        {
            for (var i:int = 0; i < _lines.length; i++) 
            {
                var line:Line = _lines[i];
                if (i % 2 == 1)
                {
                    line.color.h += 7;
                    line.draw(
                        new Point((i * INTERVAL - stage.stageWidth)+ stage.stageHeight, 0), 
                        new Point(i * INTERVAL -stage.stageWidth, stage.stageHeight),
                        line.color.value
                    );
                }
                else
                {
                    line.color.h -= 7;
                    line.draw(
                        new Point(i * INTERVAL - stage.stageWidth, 0), 
                        new Point((i * INTERVAL -stage.stageWidth) + stage.stageHeight, stage.stageHeight),
                        line.color.value
                    );
                }
            }
        }
    }
}

import flash.display.BlendMode;
import flash.display.Shape;
import flash.geom.Point;
import frocessing.color.ColorHSV;

class Line extends Shape
{
    private var _color:ColorHSV;
        
    public function Line() 
    {
        _color = new ColorHSV();
        //this.blendMode = BlendMode.LIGHTEN;
    }
        
    public function draw(pos1:Point, pos2:Point, color:uint ):void
    {
        graphics.clear();
        graphics.lineStyle(0, _color.value,0.7);
        graphics.moveTo(pos1.x, pos1.y);
        graphics.lineTo(pos2.x, pos2.y);
    }
        
    public function get color():ColorHSV { return _color; }
    public function set color(value:ColorHSV):void 
    {
        _color = value;
    }
        
}