jieguo=Math.atan2(e.stageY,180, e.stageX,360);
这里的180是两个圆的x y 需要用当前点的坐标减去原点坐标获得距离
var timer:egret.Timer=new egret.Timer(1,0);
timer.addEventListener(egret.TimerEvent.TIMER,cont6,this);
// var jiaodu=180-ang.jieguo;
function cont6(){
console.log(jiaodu);
// this.removeChild(myScroller);
///
///
//想让小秋移动 需要sin cos角度 乘速度 再加小球x y
//想让小球不停移动需要加个定时器
sky.x=Math.cos(ang.jieguo)*10+sky.x;
sky.y=Math.sin(ang.jieguo)*10+sky.y;//Math.cos(ang.jieguo)*10
myScroller.viewport.scrollV =myScroller.viewport.scrollV+Math.sin(ang.jieguo)*10; //纵向滚动的位置
myScroller.viewport.scrollH =Math.cos(ang.jieguo)*10+myScroller.viewport.scrollH
// enemy.x =enemy.x+6; //纵向滚动的位置
// this.addChild(myScroller);
// timer.start();
}
``
想让物体 背景 不停移动需要加个定时器
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190819164810567.gif)