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

Prism

Get Adobe Flash player
by onedayitwillmake 24 Jun 2009
/**
 * Copyright onedayitwillmake ( http://wonderfl.net/user/onedayitwillmake )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dnqr
 */

package
{
	import flash.display.BlendMode;
	import flash.display.CapsStyle;
	import flash.display.JointStyle;
	import flash.display.LineScaleMode;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.filters.BlurFilter
	import flash.display.StageAlign;
	import flash.display.StageQuality;
	import flash.display.StageScaleMode;
	import flash.utils.Dictionary;
	
	import frocessing.color.ColorHSV;
	import frocessing.color.ColorRGB;
	
	import org.libspark.betweenas3.BetweenAS3;
	import org.libspark.betweenas3.easing.*;
	import org.libspark.betweenas3.tweens.*;
	
	
	[SWF(width='465', height='465', backgroundColor='0x000000', frameRate='60')]
	
	public class Prism extends Sprite
	{
		public var _vars:Dictionary = new Dictionary(true);
		public static var NUM_LAYERS	:int = 70;
		
		public function Prism()
		{
                    Wonderfl.capture_delay(5);
			super();
			
			x = stage.stageWidth - 100;
			y = -200;
			rotation = 45;
			var tList:Array = new Array();
			//filters = [new BlurFilter(4, 64, 1)]
			var t:ITween = BetweenAS3.tween(this, {scaleX: Math.random() * 0.5 - 0.25 + 1}, null, Math.random() * 4 + 1, Expo.easeInOut);
				tList.push(t);
				tList.push(BetweenAS3.tween(this, {scaleX: 1}, null, 3, Back.easeInOut));

				t = BetweenAS3.serial.apply(null, tList);
				//t.stopOnComplete = false;
				t.play()
			
		//	rotation = 45
			initStage();
			run();
		}
		
		public function run():void
		{
			var rs:Number = 0, gs:Number = 0, bs:Number = 0;
			var colorRGB:ColorRGB
			var i:int;
			var tList:Array = new Array();
			
//			BetweenAS3.tween(this, {alpha: 1}, {  alpha:0}, 0, Expo.easeInOut).play();
			alpha = 1;
			for (i = 0; i < NUM_LAYERS; i++)
			{
				tList = new Array();
				colorRGB = new ColorHSV((i / NUM_LAYERS) * 360, 1, 1).toRGB();
				rs += colorRGB.r;
				gs += colorRGB.g;
				bs += colorRGB.b;
				
				var s:Shape = new Shape();
//					s.graphics.lineStyle(1, 0xffffff, 0.2, false, LineScaleMode.NONE, CapsStyle.NONE, JointStyle.MITER)
					s.graphics.beginFill(colorRGB.value, 1);
					s.graphics.drawRect(0, 0, Math.random() * 3 + 3, Math.random()* 3 + 3);
					s.graphics.endFill();
					
					// This changes the color
					s.x = i * (stage.stageWidth / NUM_LAYERS);
					s.alpha = Math.random() + 0.4
					s.blendMode = BlendMode.ADD;
					//s.filters = [new BlurFilter(8, 8, 1)]
					addChild(s);
					
				var t:ITween = BetweenAS3.tween(s, { scaleY: stage.stageHeight }, { y: 0, scaleY: 1 } , 1, Sine.easeInOut)
					//t = BetweenAS3.parallel(t, BetweenAS3.tween(s, {}, {}, t.duration, Sine.easeOutIn));
					t = BetweenAS3.delay(t, i * 0.03);
					//t.stopOnComplete = false;
					t.play()
					//continue;
				var tB:ITween = BetweenAS3.tween(s, { y: stage.stageHeight +  Math.random() * 100  + 200}, null, 1, Cubic.easeIn);
					
					// Now group them
					tList.push(t);
					tList.push(tB);
				
					t = BetweenAS3.serial.apply(null, tList);
					t.stopOnComplete = false;
					t.gotoAndPlay(Math.random());
					
				
				//colorRGB.value);
			}
			
		}
		public function initStage():void
		{
			stage.quality = StageQuality.LOW;
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
		}
		
	}
}