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

gradation square

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

package  {
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.geom.Matrix;

	[SWF(width="400", height="400", backgroundColor="#000000")]
	
	public class study5 extends Sprite{
		
		public function study5() {
			//座標を変換する
			this.x = this.y = 200;
			
			var matrix:Matrix = new Matrix();
			
			for(var r1:int=0; r1<360; r1+=30){
				var group:Sprite = new Sprite();
				addChild(group);
				//座標変換
				matrix.identity();
				matrix.translate(100,0); //移動
				matrix.rotate(Math.PI/180*r1); 
				group.transform.matrix = matrix;
				
				var hue:Number = Math.random();
				for(var r2:int=0; r2<360; r2+=30){
					//図形を描く
					for(var i:int=1; i<=5; i++){
						var color:uint = HSBtoRGB(hue,i*20/100,1); //HSBからcolor値を求める
						var shape:Shape = new Shape();
						var size:Number = 60 - i*10;
						shape.graphics.beginFill(color,0.8);
						shape.graphics.drawRect(0,0,size, size);
						group.addChild(shape);
						//座標変換
						matrix.identity();
						matrix.translate(50,0); //移動
						matrix.rotate(Math.PI/180*r2); 
						shape.transform.matrix = matrix;
					}
				}
			}
		}
		
		/** 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);
        }		
	}
	
}