イージング
♥0 |
Line 40 |
Modified 2010-01-01 23:24:31 |
MIT License
archived:2017-03-30 05:53:50
ActionScript3 source code
/**
* Copyright _wonder ( http://wonderfl.net/user/_wonder )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/tJMd
*/
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width="465",height="465",frameRate="30")]
public class MoveTest extends Sprite {
private var circle:Sprite;
private var _startX:Number = 5;
private var _startY:Number = 200;
private var _radius:Number = 5;
private var _color:uint = 0x000000;
private var _rate:Number = 0.2;
public function MoveTest() {
circle = new Sprite;
circle.graphics.beginFill(_color);
circle.graphics.drawCircle(0,0,_radius);
circle.graphics.endFill();
circle.x = _startX;
circle.y = _startY;
addChild(circle);
start();
}
private function start():void{
circle.addEventListener(Event.ENTER_FRAME,move);
}
private function stop():void{
circle.removeEventListener(Event.ENTER_FRAME,move);
}
private function move(e:Event):void{
if(circle.x < stage.stageWidth){
circle.x += Math.ceil((stage.stageWidth-circle.x)*_rate)
} else {
stop();
end_func();
}
}
private function end_func():void{
circle.x = 5;
}
}
}