Dead Code Preservation :: Archived AS3 works from wonderfl.net

burn

Get Adobe Flash player
by 178ep3 14 Dec 2009
    Embed
/**
 * Copyright 178ep3 ( http://wonderfl.net/user/178ep3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/NHSg
 */

package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.filters.BlurFilter;

	public class Burn extends Sprite
	{
		public function Burn()
		{
			var stg:Sprite = new Sprite();
			var list:Array = [];
			
			var i:uint=0;
			for(i=0; i<3000; i++)
			{
				var p:Particle = stg.addChild(new Particle())as Particle;
				p.x = Math.random()*100-50 + 233;
				p.y = Math.random()*100-50 + 233;
				var angle:Number = Math.random()*360*Math.PI/180;
				p.speed = Math.random()*2+1;
				p.sx = Math.cos(angle)*p.speed;
				p.sy = Math.sin(angle)*p.speed;
				list[i] = p;
			}
			
			var center:Shape = stg.addChild(new Shape())as Shape;
			center.x = center.y = 233;
			center.graphics.beginFill(0);
			center.graphics.drawCircle(0,0,40);
			center.graphics.endFill();
			
			stg.filters = [new BlurFilter(5,5,2)];
			
			addEventListener(Event.ENTER_FRAME,loop);
			
			var bmp:Bitmap = addChild(new Bitmap(new BitmapData(465,465,true,0)))as Bitmap;
			
			var shape:Shape = new Shape();
			shape.graphics.beginFill(0,0.05);
			shape.graphics.drawRect(0,0,465,465);
			shape.graphics.endFill();
			
			function loop(e:Event):void
			{
				bmp.bitmapData.draw(shape);
				for(i=0; i<3000; i++)
				{
					list[i].move();
				}
				bmp.bitmapData.draw(stg);
			}
		}
		
	}
}
	import flash.display.Shape;
	import flash.geom.Point;
	
class Particle extends Shape
{
	public var speed:Number;
	public var sx:Number;
	public var sy:Number;
	private var _zero:Point = new Point(233,233);
	public var gravity:Number=1;
	
	public function Particle()
	{
		this.graphics.beginFill(0xff<<16 | 0x90*Math.random()<<8 | 0x00);
		this.graphics.drawCircle(0,0,1);
		this.graphics.endFill();
		this.scaleX = this.scaleY = 0.75;
	}
	
	public function move():void
	{
		if(this.x > _zero.x)sx -= gravity;
		else sx += gravity;
		if(this.y > _zero.y)sy -= gravity;
		else sy += gravity;
		sx*=0.998;
		sy*=0.998;
		this.x += sx;
		this.y += sy;
	}
}