2013-02-27 63 views
0

我想顺时针和逆时针旋转我的形状,具体取决于我移动鼠标的方向。这里是样本有点我知道不完全完美..如果可能,编辑我的偏移量和旋转部分。这里是fiddlekineticjs中的旋转os形状

回答

0

你可以做这样的事情做有条件的旋转:(伪代码和实际代码混合)

var currentRotation = shape.getRotation(); 
    var direction = ..stuff.. ; // your logic for mouse movement, result should be 1 or -1 
    var rotationAmount = 0.5; 

    shape.setRotation(currentRotation + direction * rotationAmount); //get current rotation and add/subtract some arbitrary amount 

如果你需要一个偏移量,你可以这样做:

shape.setOffset(x,y);