じわっと光る文字 ProjectNya forked:9favorite:3lines:75license : MIT License modified : 2010-11-08 11:34:13 Embed Tweet //////////////////////////////////////////////////////////////////////////////// // じわっと光る文字 //////////////////////////////////////////////////////////////////////////////// package { import flash.display.Sprite; import flash.events.Event; import flash.filters.GlowFilter; [SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")] public class Main extends Sprite { private var label:Label; private var angle:Number = -90; private static var radian:Number = Math.PI/180; public function Main() { //Wonderfl.capture_delay(1); init(); } private function init():void { graphics.beginFill(0x000000); graphics.drawRect(0, 0, 465, 465); graphics.endFill(); // label = new Label(200, 80, 60, Label.CENTER); addChild(label); label.x = 132; label.y = 192; label.textColor = 0xFFFFFF; label.text = "wonderfl"; // addEventListener(Event.ENTER_FRAME, update, false, 0, true); } private function update(evt:Event):void { angle ++; var blur:Number = (Math.cos(angle*radian)*0.45 + 0.55)*16; label.filters = [new GlowFilter(0xFFFFFF, 1, blur, blur, 2, 3, false, false)]; } } } ////////////////////////////////////////////////// // Labelクラス ////////////////////////////////////////////////// import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldType; import flash.text.TextFieldAutoSize; import flash.text.AntiAliasType; import flash.text.TextFormat; import flash.text.TextFormatAlign; class Label extends Sprite { private var txt:TextField; private static var fontType:String = "_ゴシック"; private var _width:uint = 20; private var _height:uint = 20; private var size:uint = 12; public static const LEFT:String = TextFormatAlign.LEFT; public static const CENTER:String = TextFormatAlign.CENTER; public static const RIGHT:String = TextFormatAlign.RIGHT; public function Label(w:uint, h:uint, s:uint = 12, align:String = LEFT) { _width = w; _height = h; size = s; draw(align); } private function draw(align:String):void { txt = new TextField(); addChild(txt); txt.width = _width; txt.height = _height; txt.autoSize = align; txt.type = TextFieldType.DYNAMIC; txt.selectable = false; //txt.embedFonts = true; //txt.antiAliasType = AntiAliasType.ADVANCED; var tf:TextFormat = new TextFormat(); tf.font = fontType; tf.size = size; tf.align = align; txt.defaultTextFormat = tf; textColor = 0x000000; } public function set text(param:String):void { txt.text = param; } public function set textColor(param:uint):void { txt.textColor = param; } } Code Fullscreen Preview Fullscreen takishiki ton_ bradsedito : beautiful.nicesimple,Veryyetsimple, yet beautiful. Very nice Very beautiful. nice simple, yet TextFormatAlign.LEFT TextFormatAlign.RIGHT type filters TextFormatAlign.CENTER String GlowFilter height width addChild addEventListener text Math.cos Event.ENTER_FRAME Math.PI Event Sprite uint Number sort new page view favorite forked pv162 forked from: じわっと光る文字 asikoh forked:0 favorite:0lines:75 (diff:1) pv153 forked from: じわっと光る文字 kurenai forked:0 favorite:0lines:75 (diff:1) pv160 forked from: じわっと光る文字 dum forked:0 favorite:0lines:75 (diff:1) pv0 forked from: じわっと光る文字 nomanishere forked:0 favorite:0lines:75 (diff:1) pv2183 じわっと光る文字 (2) ProjectNya forked:3 favorite:1lines:87 (diff:15) pv177 forked from: じわっと光る文字 rie1 forked:0 favorite:0lines:75 (diff:1) pv213 forked from: じわっと光る文字 DrManhattan forked:0 favorite:0lines:75 (diff:2) pv191 forked from: じわっと光る文字 bradsedito forked:0 favorite:0lines:81 (diff:16) 1 2NEXT