0

Im trying to tween to mouseposition but it does not focus the mouse. It goes to the side. Anybody sees the failure?

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();


    }
  }
koyotee
  • 45
  • 8

0 Answers0