0
请参阅下面的小提琴:https://jsfiddle.net/logie17/r5zptv4o/旋转围绕fabric.js另一个对象的另一个独立的对象
我试图做旋转物体B.当是旋转对象的对象B在我的旋转功能看起来像这样:
function rotate() {
let obj = boundingBox;
obj.setCoords();
let angle = fabric.util.degreesToRadians(obj.getAngle());
let center = obj.getCenterPoint();
let origin = new fabric.Point(center.x, center.y);
let newCoords = fabric.util.rotatePoint(movingBox.getCenterPoint(),origin,angle);
movingBox.set({ left: newCoords.x, top: newCoords.y }).setCoords();
}
但是正如你从小提琴中看到的那样,物体A旋转很快。我想保持旋转的速度与旋转对象B相同。任何帮助将不胜感激。
对象B将需要坚持对象A,否则它会围绕其中心旋转? – Durga