flash on 2010-2-17
♥0 |
Line 34 |
Modified 2010-02-17 18:46:10 |
MIT License
archived:2017-03-20 14:44:07
ActionScript3 source code
/**
* Copyright deform ( http://wonderfl.net/user/deform )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/q9sV
*/
package {
import flash.text.TextField;
import flash.filters.BlurFilter;
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
private var square:Sprite;
private var bFlt:BlurFilter;
private var tf:TextField;
private var blurNum:int = 0;
public function FlashTest() {
// write as3 code here..
tf = new TextField();
addChild(tf);
square = new Sprite();
square.graphics.beginFill(0x0);
square.graphics.drawRect(0,0,100,100);
square.graphics.endFill();
addChild(square);
square.x = stage.stageWidth/2;
square.y = stage.stageHeight/2 - square.height/2;
bFlt = new BlurFilter(0,0,1);
addEventListener(Event.ENTER_FRAME, _upDate);
}
private function _upDate(e:Event):void
{
// if(square.rotationY > 360 || square.rotationY < -360) square.rotationY = 0;
square.rotationY += -1;
blurNum = Math.sin((square.rotationY)/360)*50;
if(blurNum < 0) blurNum = blurNum*-1;
bFlt = new BlurFilter(blurNum, blurNum, 1);
square.filters = [bFlt];
tf.text = "rotation Y : "+blurNum;
}
}
}