forked from: textanim hello
/**
* Copyright prolificreator ( http://wonderfl.net/user/prolificreator )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/csFL
*/
// forked from g3index's textanim hello
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.events.Event;
import flupie.textanim.*;
import caurina.transitions.*;
import caurina.transitions.properties.*;
import net.wonderfl.utils.FontLoader;
[SWF(width='605', height='220', backgroundColor='#000000', frameRate='120')]
public class FlashTest extends Sprite
{
public var ta:TextAnim;
public var tf:TextField;
public var fm:TextFormat;
public var fl:FontLoader = new FontLoader;
public var fn:String = "Bebas";
public function FlashTest()
{
fl.load(fn);
fl.addEventListener(Event.COMPLETE, fontLoaded, false, 0, true);
}
public function fontLoaded(e:Event):void
{
//Creating TextFormat for format my tf = TextField
fm = new TextFormat(fn, 24, 0xFFFFFF);
fm.align = "center";
//TextField that's will be passed for TextAnim with all TextField setting already done
tf = new TextField();
tf.autoSize = "left";
tf.embedFonts = true;
tf.defaultTextFormat = fm;
tf.text = "Hello, I am a font " + fn + " and\nnow I am in wonderfl.net with TextAnim";
tf.x = (stage.stageWidth/2) - (tf.width/2);
tf.y = (stage.stageHeight/2) - (tf.height/2);
addChild(tf);
//Tweener init shortcuts
ColorShortcuts.init();
FilterShortcuts.init();
//Create TextAnim instance and start
TextAnim.create(tf, {effects:myEffect}).start();
}
public function myEffect(block:TextAnimBlock):void
{
block.alpha = 0;
block.x = block.posX + 60;
block.scaleX = block.scaleY = 0;
if (block.index % 2 == 0) {
block.y = block.posY + 20;
block.rotation = 40;
Tweener.addTween(block, {_color:0x194CFF});
} else {
block.y = block.posY - 20;
block.rotation = -40;
Tweener.addTween(block, {_color:0xFF2E40});
}
Tweener.addTween(block, {_Glow_blurX:40,_Glow_blurY:40, _Glow_alpha:.5});
Tweener.addTween(block, {_color:null, time:.3, transition:"easeinoutback", delay:.3});
Tweener.addTween(block, {alpha:1, rotation:0, scaleX:5, scaleY:5, time:.5, transition:"easeinoutback"});
Tweener.addTween(block, {scaleX:1, scaleY:1, time:.3, transition:"easeinoutquart", delay:.5});
Tweener.addTween(block, {_Glow_blurX:0,_Glow_blurY:0, _Glow_color:null, x:block.posX, y:block.posY, time:1, transition:"easeoutquart", delay:.5});
}
}
}