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

さくらパーティクル

Get Adobe Flash player
by chieinoue 15 Mar 2010
    Embed
/**
 * Copyright chieinoue ( http://wonderfl.net/user/chieinoue )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7L9R
 */

package {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;

    public class Main extends Sprite {
    
    	    public function Main(){	
		    var base:Sprite = new Sprite();
		    
            var fillType:String = GradientType.LINEAR;
            var colors:Array = [0xB4E7FA, 0xFFFFFF];
            var alphas:Array = [1, 1];
            var ratios:Array = [0x00, 0xFF];
            var matr:Matrix = new Matrix();
            var rotation:Number = Math.PI / 2;
            matr.createGradientBox(250, 450, rotation, 0, 0);
            var spreadMethod:String = SpreadMethod.PAD;
            base.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);  
            base.graphics.drawRect(0,0,500,500);
            addChild(base);
			
			addEventListener(Event.ENTER_FRAME, function(event:Event):void{
				for(var i:int = 0; i < 15; i++){
					var circle:Circle = new Circle();
					base.addChild(circle);
				}
			});
    	    }
    }
}

import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import com.flashdynamix.motion.*;
import fl.motion.easing.*;
import flash.events.*;

internal class Circle extends Sprite{

	public function Circle():void{
		var container:Sprite = new Sprite();		
		var child:Shape = new Shape();
		var size:uint = Math.round((2 + Math.random() * 2));
		child.graphics.beginFill(getColor());
		child.graphics.drawCircle(size, size, size);
		child.graphics.endFill();
		child.x = -500 + Math.random() * 1000;
		child.y = 0;
		child.scaleY = 1.5;
		child.rotation = -30 + Math.random() * 60;
		container.addChild(child);
		addChild(container);
		
		var direction:int = 1;
		var rangeX:int = 50 + Math.floor(Math.random() * 50);
		var duration:int = 15 + Math.floor(Math.random() * 10);
		var timeline:TweensyTimeline = Tweensy.to(container, {y:500+child.height}, duration, Back.easeOut);
		timeline.onComplete = function():void{
			removeChild(container);
		};
        Tweensy.to(container, {x:500}, duration);
		addEventListener(Event.ENTER_FRAME, function(event:Event):void{
			child.x += direction;
			
			if(child.x < -1 * rangeX) direction *= -1;
			if(child.x > rangeX) direction *= -1;
		});		
	}
	
	private function getColor():uint{
		/*
		var red:uint = 0x0000FF << 16;
		var green:uint = (Math.random()*0x000066) << 8;
		var blue:uint = Math.random()*0x0000CC;
		return red+green+blue;
		*/
		return 0xFFE6E6;	//FFEEEE
	}
}