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

Bubble

「僕…本当は…シャボン玉になりたかったんです!」
「ごめん」
/**
 * Copyright maccyan ( http://wonderfl.net/user/maccyan )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/olWI
 */

//「僕…本当は…シャボン玉になりたかったんです!」
//「ごめん」
package {
    import flash.display.*;
    import flash.events.*;
	import flash.geom.*;
    
    public class main extends Sprite {
        private var syabondama:Object = new Object();
        private var id:Number = 0;
        private var syabonInt:Number = 0;
		private var syabon:Sprite;
        
        public function main() {
  
           stage.addEventListener(Event.ENTER_FRAME, sub);
        }
 
        private function sub(e:Event = null):void {
           for(var i:String in syabondama) {
				syabondama[i].x += (-1 + Math.floor(Math.random() * 3));
				syabondama[i].x += Math.sin(100 * Math.PI / 360);
				syabondama[i].x -= Math.sin(100 * Math.PI / 360);
					
				syabondama[i].y -= 10;
								
				syabondama[i].z += (-1 + Math.floor(Math.random() * 3));
				syabondama[i].z += Math.sin(100 * Math.PI / 360);
				syabondama[i].z -= Math.sin(100 * Math.PI / 360);
                
                if(syabondama[i].y <= -200){
					syabondama[i].x = Math.floor(Math.random() * (stage.stageWidth));
					syabondama[i].z = Math.floor(Math.random() * (stage.stageWidth));
					syabondama[i].y = 600;
				}
           }
           
           makeSyabon();
               
        }
		
        private function makeSyabon():void {
            syabon = new Sprite();
			
            syabondama["syabondama"+id] = syabon;
            id++; 
            
			if(id < 200){
				syabon.graphics.lineStyle(1, 0xFFFFFF, 0.5);
			
				var type:String = GradientType.RADIAL;
				var colors:Array = [0xFFFFFF,0x6699FF];
				var alphas:Array = [1,1];
				var ratios:Array = [0,255];
				var matrix:Matrix = new Matrix();
				
				matrix.createGradientBox(2 * 8, 2 * 8, 0, 0, 0);
				matrix.translate(-8, -8);
				matrix.rotate(Math.PI / 4);
				
				var spread:String = SpreadMethod.PAD;
				var interpolation:String = "rgb";
				var focalPointRatio:Number = -0.6;
				
				syabon.graphics.beginGradientFill(type,colors,alphas,ratios,matrix,spread,interpolation,focalPointRatio);
				
				syabon.graphics.drawCircle(0, 0, 8);
				syabon.graphics.endFill();
            
				
				syabon.x = Math.floor(Math.random() * (stage.stageWidth));
				syabon.z = Math.floor(Math.random() * (stage.stageWidth));
				syabon.y = 600;
				this.addChild(syabon);
			}
        }
    }
}