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

Get Adobe Flash player
by kidaipu 18 Aug 2009
    Embed
/**
 * Copyright kidaipu ( http://wonderfl.net/user/kidaipu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/qp6q
 */

package {
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.filters.BlurFilter;
	import flash.geom.Point;
	import flash.text.AntiAliasType;
	import flash.text.Font;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.utils.Timer;

	[SWF(width = "500", height = "500", frameRate = "30", backgroundColor = "#ffffff")]
	public class ColorFont extends Sprite
	{
		//
		private var Sp1:Sprite;
		private var Sp2:Sprite;
		private var Sp3:Sprite;
		
		//コンストラクタ	
		public function ColorFont()
		{
			//テキストフィールド
			var txt:TextField = new TextField();
			txt.antiAliasType = AntiAliasType.ADVANCED;
			txt.autoSize = "left";
			
			var txt2:TextField = new TextField();
			txt2.antiAliasType = AntiAliasType.ADVANCED;
			txt2.autoSize = "left";
			
			var txt3:TextField = new TextField();
			txt3.antiAliasType = AntiAliasType.ADVANCED;
			txt3.autoSize = "left";
			
			
			//テキストフォーマット
			var aFonts:Array = Font.enumerateFonts(true);
			var fnt:Font = aFonts[12];
			var tf:TextFormat = new TextFormat();
			tf.font = fnt.fontName;
			tf.size = 190;
			tf.bold = true;
			
			var tf2:TextFormat = tf;
			var tf3:TextFormat = tf;

                        var str:String = "涼〜";
			//個別にセット
			txt.text = str;
			txt.textColor = 0x00ff00;
			txt.selectable = false;
			txt.setTextFormat(tf, 0, txt.length); //フォントセット
			
			txt2.text = str;
			txt2.textColor = 0x0000ff;
			txt2.selectable = false;
			txt2.setTextFormat(tf2, 0, txt2.length);
			
			txt3.text = str;
			txt3.textColor = 0xff2200;
			txt3.selectable = false;
			txt3.setTextFormat(tf3, 0, txt3.length);
		
			
			//ビットマップデータ
			var bd:BitmapData = new BitmapData(txt.width, txt.height, true, 0xffffff);
            bd.draw(txt);
            //bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter(2,2,1));
			//bd.draw(txt);
            var bd2:BitmapData = new BitmapData(txt2.width, txt2.height, true, 0xffffff);
            bd2.draw(txt2);
            var bd3:BitmapData = new BitmapData(txt3.width, txt3.height, true, 0xffffff);
            bd3.draw(txt3);
            
            

        	//ビットマップ
 	       	var bmp:Bitmap = new Bitmap(bd);
 	       	bmp.smoothing = true;
        	bmp.alpha = 0.5;
        	bmp.x = - bmp.width / 2; //回転軸を中心に持ってくる
        	bmp.y = - bmp.height / 2;
    		var bmp2:Bitmap = new Bitmap(bd2);
    		bmp2.smoothing = true;
        	bmp2.alpha = 0.5;
	      	bmp2.x = - bmp2.width / 2; //回転軸を中心に持ってくる
        	bmp2.y = - bmp2.height / 2;
        	var bmp3:Bitmap = new Bitmap(bd3);
        	bmp3.smoothing = true;
        	bmp3.alpha = 0.3;
	      	bmp3.x = - bmp3.width / 2; //回転軸を中心に持ってくる
        	bmp3.y = - bmp3.height / 2;
        	
    		//スプライト
           	Sp1 = new Sprite();
            Sp1.scaleX *= 2;
            Sp1.scaleY *= 2;
           	Sp1.x = 250;
           	Sp1.y = 250;
           	Sp1.addChild(bmp);
       		addChild(Sp1);
           	Sp2 = new Sprite();
            Sp2.scaleX *= 2;
            Sp2.scaleY *= 2;
           	Sp2.x = 250;
           	Sp2.y = 250;
  			Sp2.addChild(bmp2);
  			addChild(Sp2);
  			Sp3 = new Sprite();
           	Sp3.x = Sp3.y = 250;
           Sp3.scaleX *= 2;
            Sp3.scaleY *= 2;
  			Sp3.addChild(bmp3);
			addChild(Sp3);
			
			//タイマー
			var timer:Timer = new Timer(50, 0);
			timer.addEventListener(TimerEvent.TIMER,Loop);
			timer.start();
		}
		
		//ループ
		private var LoopCount:int = 1;
		private function Loop(e:TimerEvent):void
		{			var Pase:int = 18;
			
			Sp1.rotation = (LoopCount > Pase*2/3 ) ? Sp1.rotation - 1.0 : (LoopCount <= Pase/3 ) ? Sp1.rotation + 0.0 : Sp1.rotation + 1.0;
			Sp2.rotation = (LoopCount > Pase*2/3 ) ? Sp2.rotation + 0.0 : (LoopCount <= Pase/3 ) ? Sp2.rotation + 1.0 : Sp2.rotation - 1.0;
			Sp3.rotation = (LoopCount > Pase*2/3 ) ? Sp3.rotation + 1.0 : (LoopCount <= Pase/3 ) ? Sp3.rotation - 1.0 : Sp3.rotation + 0.0;
			
			Sp1.scaleX = (LoopCount <= Pase/2 ) ? Sp1.scaleX + 0.019 : Sp1.scaleX - 0.019;
			Sp2.scaleX = (LoopCount <= Pase/2 ) ? Sp2.scaleX - 0.011 : Sp2.scaleX + 0.011;
			Sp3.scaleX = (LoopCount <= Pase/2 ) ? Sp3.scaleX + 0.012 : Sp3.scaleX - 0.012;
			
			Sp1.scaleY = (LoopCount <= Pase/2 ) ? Sp1.scaleY + 0.019 : Sp1.scaleY - 0.019;
			Sp2.scaleY = (LoopCount <= Pase/2 ) ? Sp2.scaleY - 0.011 : Sp2.scaleY + 0.011;
			Sp3.scaleY = (LoopCount <= Pase/2 ) ? Sp3.scaleY + 0.012 : Sp3.scaleY - 0.012;
			
		/*	//停止
			if(LoopCount == 27 || LoopCount == 3)
			{
				e.target.reset();
				var timer:Timer = new Timer(10,50);
				timer.start();
				timer.addEventListener(TimerEvent.TIMER_COMPLETE, function():void{e.target.start();});
			}
		*/
			
			LoopCount = (LoopCount % Pase == 0) ? 1 : LoopCount + 1;}
	}
}