Draw Circle 沿着圆运动~~


//中心坐标
const centerX = 200
const centerY = 150;
//旋转半径
const r = 200;

var timer:Timer = new Timer(30);//间隔为30ms
var t1:Number = 0;
var t2:Number = 180;

timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();

a.tip.text="aaaa";
b.tip.text="bbbb";


function timerHandler(e:TimerEvent):void {

if(t1==180)
timer.removeEventListener(TimerEvent.TIMER, timerHandler);

a.x = centerX + r*Math.cos(t2/180*Math.PI);
a.y = centerY + r*Math.sin(t2/180*Math.PI);

b.x = centerX + r*Math.cos(t1/180*Math.PI);
b.y = centerY + r*Math.sin(t1/180*Math.PI);
trace(a.x+"===="+b.x);
trace(a.y+"==="+a.y);
/* a.x = centerX + r*Math.cos(t);
a.y = centerY + r*Math.sin(t);*/
t1 += 5;
t2 += 5;
trace(t1+"========"+t2)



e.updateAfterEvent();

}

posted on 2014-01-20 09:22  主人的成长  阅读(334)  评论(0编辑  收藏  举报

导航