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

Flan Pie

needs some z-sorting
Get Adobe Flash player
by rigard 09 Jan 2009
    Embed
// needs some z-sorting
package 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.filters.BlurFilter;
	import flash.filters.GlowFilter;
	import flash.geom.ColorTransform;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	/**
	 * ...
	 * @author Rigard Kruger
	 */
	[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="30")]
	public class Fly extends Sprite  
	{
		
		private static const STAGE_WIDTH:int = 465;
		private static const STAGE_HEIGHT:int = 465;
		
		private var _flyers:Vector.<Flyer> = new Vector.<Flyer>();
		private var _wrapper:Sprite;
		private var _container:Sprite;
		
		private var _output:Bitmap;
		
		private var _rect:Rectangle = new Rectangle(0, 0, 465, 465);
		
		public function Fly()
		{
			
			var numFlyers:int = 24;
			var ang:Number = 360 / numFlyers;
			
			_wrapper = new Sprite();
			_container = new Sprite();
			_container.x = STAGE_WIDTH / 2;
			_container.y = STAGE_HEIGHT / 2;
			_container.z = 500;
			_wrapper.addChild(_container);
			
			for (var i:int = 0; i < numFlyers; i++)
			{
				var amplitude:Number = 150;// + 100 * Math.cos(ang / 180 * Math.PI * i);
				var flyer:Flyer = new Flyer();
				flyer.amplitude = amplitude;
				flyer.rotationY = ang * i;
				flyer.y = - 100;
				_container.addChild(flyer);
				
				_flyers.push(flyer);
			}
			
			addEventListener(Event.ENTER_FRAME, onFrame);
			
			_output = new Bitmap(new BitmapData(STAGE_WIDTH, STAGE_HEIGHT, true, 0x00000000));
			addChild(_output);
		}
		
		private function onFrame(e:Event) : void
		{
			for each (var flyer:Flyer in _flyers)
			{
				flyer.rotationY += 3;
			}
			
			_container.rotationX += 2;
			_container.rotationY += 1;
			_container.rotationZ += 1.5;
			
			var bd:BitmapData = _output.bitmapData;
			_output.bitmapData.draw(_wrapper);
			
			var ct:ColorTransform = new ColorTransform();
			ct.alphaMultiplier = 0.7;// 9;
			ct.redMultiplier = 1.5;
			bd.colorTransform(_rect, ct);
			bd.applyFilter(bd, _rect, new Point(), new GlowFilter(0x0000ff, 0.5, 6, 6, 1));
			bd.applyFilter(bd, _rect, new Point(), new BlurFilter());
			
			//_output.bitmapData = bd;
		}
		
	}
	
}

import flash.display.Sprite;
import flash.events.Event;

class Flyer extends Sprite
{
	private var _dots:Vector.<Dot> = new Vector.<Dot>();
	
	private var _angle:Number = 0;
	private var _amplitude:Number = 100;
	
	public function set amplitude(val:Number) : void { _amplitude = val; }
	
	public function Flyer()
	{
		
		//_angle = angle / 180 * Math.PI;
		
		for (var i:int = 0; i < 40; i++)
		{
			var dot:Dot = new Dot();
			dot.x = 10 * i;
			dot.transform.colorTransform = new flash.geom.ColorTransform(1 - i * 0.03, 1 - i * 0.03, 1 + i * 0.03);
			addChild(dot);
			
			_dots.push(dot);
		}
		
		addEventListener(Event.ENTER_FRAME, onFrame);
		/*graphics.beginFill(0xffff00, 0.5);
		graphics.drawRect(0, 0, 400, 400);
		graphics.endFill();*/
	}
	
	private function onFrame(e:Event) : void
	{
		
		_angle += 4 * Math.PI / 180;
		
		var numDots:int = _dots.length;
		for (var i:int = 0; i < numDots; i++)
		{
			var dot:Dot = _dots[i];
			var ang:Number = _angle + Math.PI * 2 / numDots * i;
			dot.y = _amplitude * Math.sin(ang) * Math.cos(ang / 2) + 100;
		}
	}
}

class Dot extends Sprite
{
	public function Dot()
	{
		graphics.beginFill(0xff0000, 1);
		graphics.drawRect(0, 0, 25, 25);
		graphics.endFill();
	}
}