未命名 (3)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var temp:int;
this.addEventListener("mouseMove",rota);
var chaX:int;
var chaY:int;
//chaX = a2.x - a1.x;
//chaY = a2.y - a1.y;
trace(a1.x,a1.y);
function rota(event:Event):void {
    var dx:Number = a1.x - stage.mouseX ;
    var dy:Number = a1.y -stage.mouseY;
      
    var angle:Number = Math.atan2(dx,dy);
    a1.rotation =  - angle *180/ Math.PI;
    var ganX:Number =- Math.cos(a1.rotation) * 80 + a1.x;
    var ganY:Number = -Math.sin(a1.rotation) * 80 + a1.y;
    trace(a1.rotation);
      
      
  
    a2.x = ganX - 30;
    a2.y = ganY;
    a3.x = ganX;
    a3.y = ganY-chaY -a2.height;
}




原文地址:https://www.cnblogs.com/babyhhcsy/p/2820562.html