Javascript 设置KineticJS图像';s不移动地偏移
是否可以使用KineticJS设置对象偏移,使其不移动Javascript 设置KineticJS图像';s不移动地偏移,javascript,kineticjs,Javascript,Kineticjs,是否可以使用KineticJS设置对象偏移,使其不移动 //this moves it img.offsetX(100); //this also moves it img.offset({x:100,y:0}; 我试过了 img.setoffset({x:100,y:100}); 但这似乎没有任何作用 我知道我可以在创建图像时设置偏移量为 var newImg = new Kinetic.Image({ x: x, y: y, image: imgObject, name
//this moves it
img.offsetX(100);
//this also moves it
img.offset({x:100,y:0};
我试过了
img.setoffset({x:100,y:100});
但这似乎没有任何作用
我知道我可以在创建图像时设置偏移量为
var newImg = new Kinetic.Image({
x: x,
y: y,
image: imgObject,
name: 'image',
offset: {x:offX, y:offY}
})
位置=平移+偏移。TranslateX=X-offsetX。TranslateY=Y-offsetY。因此,如果要创建一个看起来没有移动的对象的效果(尽管它已经移动了),则需要将偏移量添加到属性x和y