kineticjs中的旋转os形状
答
你可以做这样的事情做有条件的旋转:(伪代码和实际代码混合)
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);