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