forked from: String Blur
// forked from Kay's String Blur
package {
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.filters.BevelFilter;
import flash.filters.BlurFilter;
import flash.events.Event;
import flash.geom.Point;
[SWF(backgroundColor=0x000000, width=400, height=400, frameRate=60)]
public class Take02 extends Sprite {
private const SW:Number = stage.stageWidth;
private const SH:Number = stage.stageHeight;
private var bitmapData:BitmapData;
private var tField:TextField;
private var wrapper:Sprite;
private var fBevel:BevelFilter;
private var fBlur:BlurFilter;
private var rX:Number = 0;
private var rY:Number = 0;
public function Take02():void {
fBevel = new BevelFilter();
fBevel.shadowColor = 0x006600;
fBevel.highlightColor = 0x66ff66;
fBlur = new BlurFilter();
fBlur.blurX = 2;
fBlur.blurY = 2;
wrapper = new Sprite();
wrapper.x = SW/2;
wrapper.y = SH/2;
addChild(wrapper);
var tFormat:TextFormat = new TextFormat();
tFormat.size = 60;
tFormat.font = "Arial Black";
tFormat.color = 0x00cc00;
tField = new TextField();
tField.defaultTextFormat = tFormat;
tField.selectable = false;
tField.autoSize = TextFieldAutoSize.LEFT;
tField.text = "wonderfl";
tField.x = -tField.width/2;
tField.y = -tField.height/2;
wrapper.addChild(tField);
wrapper.addEventListener(Event.ENTER_FRAME, rotate);
bitmapData = new BitmapData(SW,SH,true,0x000000);
graphics.beginBitmapFill(bitmapData);
graphics.drawRect(0,0,SW,SH);
graphics.endFill();
}
private function rotate(e:Event):void {
rX+= 0.02;
rY+= 0.03;
e.target.rotationZ+=1;
fBevel.angle = -e.target.rotationZ+45;
tField.filters = [fBevel];
wrapper.x = 100*Math.cos(rX)+SW/2;
wrapper.y = 100*Math.sin(rY)+SH/2;
bitmapData.draw(stage);
bitmapData.applyFilter(bitmapData,bitmapData.rect,new Point(0,0),fBlur);
}
}
}