flash on 2011-2-2

by omari
♥0 | Line 38 | Modified 2011-02-02 01:42:32 | MIT License
play

ActionScript3 source code

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

package {

    import frocessing.display.F5MovieClip2DBmp;

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

    public class Main extends F5MovieClip2DBmp {
        // プロパティ
        private static var bWidth:uint = 600;
        private static var bHeight:uint = 300;
        private static var points:uint = 5;
        private static var ratio:Number = 1/points;
        private static var colors:uint = 360;
        private var t:Number = 0;
        private var c:uint = 0;

        // コンストラクタ
        public function Main() {
            super();
        }

        // メソッド
        public function setup():void {
            size(bWidth, bHeight);
            background(0);
            noFill();
            colorMode(HSV, colors, 1, 1);
        }
        public function draw():void {
            translate(0, bHeight*0.5);
            stroke(c, 1, 1, 0.2);
            c ++;
            c %= colors;
            beginShape();
            curveVertex(-bWidth*ratio, 0);
            for (var n:uint = 1; n <= points+1; n++) {
                var xPos:Number = n*bWidth*ratio;
                var yPos:Number = noise(n*0.25, t)*bHeight - bHeight*0.5;
                curveVertex(xPos-bWidth*ratio, yPos);
            }
            curveVertex(bWidth*(1+ratio), 0);
            endShape();
            t += 0.01;
        }

    }

}