The Dark Side of the Moon

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Digital interpretation of the iconin Pink Floyd album using live particle classes. Each particle begins as white light heading towards the same general direction. About refraction through the prism, the particle takes on it's own color, and based on that color, it's own path.

Base Flash file
for(var i:int=0; i<100; i++){
	var star:Star = new Star();
		star.x = Math.random()*550;
		star.y = Math.random()*400;
	addChild(star);
}
var tri:Sprite = new Sprite();
	tri.graphics.beginFill(0x000000, .93);
	tri.graphics.moveTo(275, 90);
	tri.graphics.lineTo(398, 309);
	tri.graphics.lineTo(152, 309);
	tri.filters = [new GlowFilter(0xdeffff, 1, 25, 25, 1, 1, true)];

var colors:Array = new Array(0xff0000,  0xffCC00, 0xffff00,  0x00ff00, 0x00ffff, 0x663399);
var angles:Array = new Array(0.7, 1.2, 1.7, 2.2, 2.7, 3.2);

var wall:Timer = new Timer(5);
wall.addEventListener(TimerEvent.TIMER, spawn);
wall.start();

function spawn(e:TimerEvent):void{
	var rand:Number = Math.floor(Math.random()*6);
	var dust:Particle = new Particle(colors[rand], angles[rand]);
	addChild(dust);
	addChild(tri);
}
  
Particle class
package{
	
	import flash.filters.GlowFilter;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.utils.Timer;
	
	
	public class Particle extends Sprite{
		
		public var col:int;
		public var ang:Number;
		public var inn:GlowFilter;
		public var outt:GlowFilter;
		public var speed:int;
		public var angle:int;
		public var xv:Number;
		public var yv:Number;
		
		
		
		public function Particle(color, angle):void{
			
			col = color;
			ang = angle;
			
				var dust:Sprite = addChild(new Sprite()) as Sprite;
				dust.graphics.beginFill(0xffffff, 1);
				dust.graphics.drawCircle(0, 250, 2);
				dust.addEventListener(Event.ENTER_FRAME, life);
				dust.filters = [new GlowFilter(0xffffff, .5, 15, 15, 5 , 1, false)];
				
				inn= new GlowFilter(col, 1, 5, 5, 5, 1, true);
				outt= new GlowFilter(col, .8, 7, 7, 7, 2, false);
				
			angle = deg2rad(-15);
			speed = 8;
			
			xv = Math.cos(angle) * speed;
			xv = Math.random()*2 + xv;
			yv = Math.sin(angle)* speed;


		}
		private function life(e:Event):void{
			if(e.target.x> 300 && e.target.x < 320){
				e.target.filters = [inn, outt];

			}
			if(e.target.x > 550){
				e.target.removeEventListener(Event.ENTER_FRAME, life);
				removeChild(Sprite(e.target));
			}
				e.target.y = (e.target.x < 300) ? e.target.y += yv : e.target.y -= -ang;
			e.target.x += Math.random()*2+xv;
		}
		
		private function deg2rad(deg:Number):Number{
			return  deg * (Math.PI/180);
		}
		
	}
}
  
Star background class
package{
	
	import flash.display.Sprite;
	import flash.filters.GlowFilter;
	import flash.events.*;
	
	public class Star extends Sprite{
		
		private var star:Sprite = new Sprite();
		
		public function Star():void{
			
			star.graphics.beginFill(0xccffff);
			star.graphics.drawCircle(0, 0, Math.random()*0.75+0.25);
			star.graphics.endFill();

			star.addEventListener(Event.ENTER_FRAME, flicker);
			addChild(star);
		}
		private function flicker(e:Event):void{
			var br:int = Math.random()*10;
			star.filters = [new GlowFilter(0xffffff, 1, br, br, 1)];
		}
	}
}