0

我试图补间到鼠标位置,但它没有聚焦鼠标。它走到一边。有人看到失败了吗?

function tweenRotate2(layer) {

      for(var n = 0; n < layer.getChildren().length; n++) {
      var shape = layer.getChildren()[n];
      var stage = shape.getStage();
      var mousePos = stage.getMousePosition();


      var x =  mousePos.x - shape.getPosition().x;
      var y = mousePos.y -shape.getPosition().y ;
      var degree = Math.PI + Math.atan(y/x);


      new Kinetic.Tween({
        node: shape, 
        rotation: degree,
        easing: Kinetic.Easings.EaseInOut,
        duration:1,
      }).play();


    }
  }
4

0 回答 0