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

forked from: まぶしい光をつくってみる

// forked from matsumos's まぶしい光をつくってみる
package {
	import flash.display.Sprite;
	import flash.display.BlendMode;
	import flash.display.DisplayObject;
	import flash.events.Event;
	import flash.filters.GlowFilter;
	import flash.filters.BlurFilter;
	import flash.geom.Point;
	import flash.geom.Matrix;

	[SWF(width="465", height="465", backgroundColor="0x461477", frameRate="60")]
	
	public class shimmer extends Sprite{
		
		private var radius:uint;
		private var ray:uint;
		private var fillMinDeg:uint;
		private var fillMaxDeg:uint;
		private var lightWeight:Number;
		private var blinkSpeed:Number;
		private var innerColor:uint;
		private var outerColor:uint;
		private var bgColor:uint;
		private var startDeg:int;
		private var endDeg:uint;
		private var container:Sprite;
		private var matrix:Matrix;
		
		public function shimmer(){

			radius = 300; //光の長さ
			ray = 120; //光条の数 もっと増やしたいけどすでに重いですね・・・
			fillMinDeg = 1; //光条の幅の下限 値を小さくするとシャープな光
			fillMaxDeg = 20; //光条の幅の上限 値を大きくするとやわらかいひかり
			lightWeight = 0.2; //光のアルファを調整
			blinkSpeed = 1.5; //光の点滅を調整
			innerColor = 0xF9C3DC; //内側の色
			outerColor = 0x954D86; //外側の色
			bgColor = 0x461477; //背景の色
			startDeg = 0; //開始角度
			endDeg = 360; //終了角度
			
			matrix = new Matrix();
                        matrix.createGradientBox(radius, radius);
			container = new Sprite();

			this.lightWeight= lightWeight;

			var glow:GlowFilter = new GlowFilter(outerColor, 1, 8, 8, 3, 1);
			var blur:BlurFilter = new BlurFilter(4, 4, 1);
			container.filters = [glow, blur];

			for (var i:int = 0; i < ray; i++){
				var blink:Number = Math.random() * .2 * blinkSpeed;
				var tmpAlpha:Number = 1;
				var fillDeg:Number = Math.random() * fillMaxDeg + fillMinDeg ;
				var sprite:exSprite = new exSprite(blink,tmpAlpha,fillDeg);
				sprite.graphics.beginGradientFill("linear", [innerColor, bgColor], [1, 0], [0, 255], matrix);
				sprite.graphics.moveTo(0,0);
				var pt:Point;
				var deg:int;
				for(deg=0; deg <= fillDeg; deg++){
					var rad:Number = (deg)*Math.PI/180;
					pt=Point.polar(radius,rad);
					sprite.graphics.lineTo(pt.x,pt.y);
				}
				sprite.graphics.lineTo(0,0);
				sprite.graphics.endFill();
				sprite.rotation = Math.random() * endDeg + startDeg -90;
				sprite.alpha = 0;
				container.addChild(sprite);
				sprite.addEventListener(Event.ENTER_FRAME, loop);
			}
			container.x = 465/2;
			container.y = 465/2;
			addChild(container);

                        //真ん中の光の玉2
			var sp2:Sprite=new Sprite;
			sp2.graphics.beginFill(0xEBC7C8, 1);
			sp2.graphics.drawCircle(0, 0, 80);
			sp2.graphics.endFill();
			var glow2:GlowFilter = new GlowFilter(0xCD6594, 1, 100, 100,2,2,true);
			var burl2:BlurFilter = new BlurFilter(80, 80, 2);
			sp2.filters = [burl2,glow2];
			//sp2.x = 465/2;
			//sp2.y = 465/2;
			sp2.blendMode = BlendMode.SCREEN;
			container.addChild(sp2);

                        //真ん中の光の玉
			var sp1:Sprite=new Sprite;
			sp1.graphics.beginFill(0xEBC7C8, 1);
			sp1.graphics.drawCircle(0, 0, 35);
			sp1.graphics.endFill();
			var glow1:GlowFilter = new GlowFilter(0xFFCC33, 1, 150, 150);
			var burl1:BlurFilter = new BlurFilter(30, 30, 1);
			sp1.filters = [burl1,glow1];
			//sp1.x = 465/2;
			//sp1.y = 465/2;
			container.addChild(sp1);

		}

		private function loop(event:Event):void {
			//光のalphaを0~1までゆらゆらさせる
			event.target.tmpAlpha -= event.target.blink ;
			event.target.alpha = Math.cos(event.target.tmpAlpha) / event.target.fillDeg / lightWeight;
		}
	}
}

import flash.display.Sprite;

class exSprite extends Sprite {

	public var fillDeg:uint;
	public var tmpAlpha:Number;
	public var blink:Number;

	function exSprite(blink:Number,tmpAlpha:Number,fillDeg:Number){
		this.blink = blink;
		this.tmpAlpha = tmpAlpha;
		this.fillDeg = fillDeg;
	}
}