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

color line

...
* @author Default
* @version 0.1
Get Adobe Flash player
by uranodai 17 Dec 2008
/**
* ...
* @author Default
* @version 0.1
*/

package  {
	import flash.display.Sprite;

	[SWF(width="200", height="200", backgroundColor="#000000")]
	
	public class study8 extends Sprite{
		
		public function study8() {
			//パターンとゆらぎ
			
			var width:Number = stage.stageWidth;
			var height:Number = stage.stageHeight;
			var range_color:int = 10;
			var range_y:int = 2;
			var fluc_color:Number = 50;
			var fluc_y:Number;
			
			for(var y:int=0; y<height; y+=5){
				fluc_color += Math.random()*range_color*2-range_color;
				
				graphics.lineStyle(1,HSBtoRGB(fluc_color/100,0.6,1),0.3);
				
				fluc_y = 0;
				fluc_y += Math.random()*range_y*2-range_y;
				graphics.moveTo(0, y+fluc_y);
				
				for(var x:int=5; x<=width; x+=5){
					fluc_y += Math.random()*range_y*2-range_y;
					graphics.lineTo(x, y+fluc_y);
				}
			}
		}
		
		/** HSBからRGBをつくる
         * @param hue 色の色相成分(小数部 * 360度が色相角度)
         * @param saturation 色の彩度(0.0 ~ 1.0 の範囲の数)
         * @param brightness 色の明度(0.0 ~ 1.0 の範囲の数)
         * @return RGBカラー
         */
        public static function HSBtoRGB(hue:Number, saturation:Number, brightness:Number):uint {
            var r:int = 0;
            var g:int = 0;
            var b:int = 0;
            if (saturation == 0) {
                r = g = b = brightness * 255.0 + 0.5;
            } else {
                var h:Number = (hue - Math.floor(hue)) * 6.0;
                var f:Number = h - Math.floor(h);
                var p:Number = brightness * (1.0 - saturation);
                var q:Number = brightness * (1.0 - saturation * f);
                var t:Number = brightness * (1.0 - (saturation * (1.0 - f)));
                switch (int(h)) {
                case 0:
                    r = brightness * 255.0 + 0.5;
                    g = t * 255.0 + 0.5;
                    b = p * 255.0 + 0.5;
                    break;
                case 1:
                    r = q * 255.0 + 0.5;
                    g = brightness * 255.0 + 0.5;
                    b = p * 255.0 + 0.5;
                    break;
                case 2:
                    r = p * 255.0 + 0.5;
                    g = brightness * 255.0 + 0.5;
                    b = t * 255.0 + 0.5;
                    break;
                case 3:
                    r = p * 255.0 + 0.5;
                    g = q * 255.0 + 0.5;
                    b = brightness * 255.0 + 0.5;
                    break;
                case 4:
                    r = t * 255.0 + 0.5;
                    g = p * 255.0 + 0.5;
                    b = brightness * 255.0 + 0.5;
                    break;
                case 5:
                    r = brightness * 255.0 + 0.5;
                    g = p * 255.0 + 0.5;
                    b = q * 255.0 + 0.5;
                    break;
                }
            }
            return (r << 16) | (g << 8) | (b << 0);
        }		
	}
	
}