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

Sunshine

Get Adobe Flash player
by leocavalcante 30 May 2010
    Embed
/**
 * Copyright leocavalcante ( http://wonderfl.net/user/leocavalcante )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/uyli
 */

package 
{
	import flash.display.Sprite;
	
	public class Main extends Sprite
	{
		public function Main()
		{
			var sunshine:Sunshine = new Sunshine(0xff0000, 0xffff00, 16, 200, 500, 1);
			sunshine.x = 200;
			sunshine.y = 200;
			sunshine.play();
			addChild(sunshine);
		}
	}
}

import flash.display.Sprite;
import flash.events.Event;
	
class Sunshine extends Sprite
{
	private var colorA:uint, colorB:uint;
	private var numShines:int;
	private var shineWidth:Number, shineHeight:Number;
	private var speed:Number;
	
	public function Sunshine(colorA:uint, colorB:uint, numShines:int, shineWidth:Number, shineHeight:Number, speed:Number):void
	{
		this.colorA = colorA;
		this.colorB = colorB;
		this.numShines = numShines;
		this.shineWidth = shineWidth;
		this.shineHeight = shineHeight;
		this.speed = speed;
		
		drawShines();
	}
	
	public function play():void
	{
		addEventListener(Event.ENTER_FRAME, enterFrame, false, 0, true);
	}
	
	public function stop():void
	{
		removeEventListener(Event.ENTER_FRAME, enterFrame);
	}
	
	private function enterFrame(event:Event):void 
	{
		rotation += speed;
	}
	
	private function drawShines():void
	{
		var i:int = -1, angle:Number = 360 / numShines;
		while (++i < numShines)
		{
			var shine:Shine = new Shine(i % 2 ? colorA : colorB, shineWidth, shineHeight);
			shine.rotation = angle * i;
			addChild(shine);
		}
	}
}

import flash.display.Shape;

class Shine extends Shape
{
	public function Shine(color:uint, width:Number, height:Number)
	{
		graphics.beginFill(color);
		graphics.lineTo(-width >> 1, height);
		graphics.lineTo(width >> 1, height);
		graphics.lineTo(0, 0);
		graphics.endFill();
	}
}