Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 KineticJs 上的 centerOffset 遇到问题,当我旋转对象(一个矩形)时,中心会偏离,我找不到纠正它的方法。
您可以在对象实例化期间指定旋转偏移量。因此,要使旋转点位于对象的中心,请将高度和宽度除以 2 :
var rect = new Kinetic.Rect({ x: 0, y: 0, width: 100, height: 50, fill: "#ff0000", offset: [50, 25] });
这对我有用(抵消了一个组元素):
your_group_element.offset( { x: 50, y: 50 } );