flash on 2011-1-3
/**
* Copyright geko ( http://wonderfl.net/user/geko )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/AdFP
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
private var _count:int = 0;
private var _vel:Number = 0;
private var _max:Number = 1;
public function FlashTest() {
addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame(event:Event):void{
_vel += Math.sin(Math.PI/2*_count/20);
_max = Math.max(_max, _vel);
graphics.clear();
graphics.beginFill(0x0);
graphics.lineStyle(1, 0x0);
graphics.moveTo(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-50);
graphics.lineTo(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15);
graphics.moveTo(stage.stageWidth/2+50, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15);
graphics.lineTo(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15);
graphics.drawCircle(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-50, 5);
graphics.drawCircle(stage.stageWidth/2+50, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15, 5);
graphics.drawCircle(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15, 5);
graphics.endFill();
_count++;
}
}
}