forked from: じわっと光る文字

by bradsedito forked from じわっと光る文字 (diff: 16)
じわっと光る文字
♥0 | Line 81 | Modified 2010-11-08 16:28:10 | MIT License
play

ActionScript3 source code

/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/Akmt
 */

// forked from ProjectNya's じわっと光る文字
////////////////////////////////////////////////////////////////////////////////
// じわっと光る文字
////////////////////////////////////////////////////////////////////////////////

package {

    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.filters.GlowFilter;
    import flash.filters.*;
    import gs.*;
    import gs.easing.*;
    import gs.plugins.*;

    [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);
                     
        }
        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)];
            
//            addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
//            function mouseOverHandler(event:MouseEvent):void {
//                {
                    TweenMax.to(label, .6, {x:stage.stageWidth/2, motionBlur:true, rotationY:rotationY++, blurFilter:[25,25,3]});
//                }   
//            }  
               
        }
        
    }

}


//////////////////////////////////////////////////
// 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;
    }

}