Reputation: 477
Is it possible to set an objects offset with KineticJS so as it doesn't move?
//this moves it
img.offsetX(100);
//this also moves it
img.offset({x:100,y:0};
ive tried;
img.setoffset({x:100,y:100});
but that doesnt seem to do anything?
i know i can set the offset when i create the image as;
var newImg = new Kinetic.Image({
x: x,
y: y,
image: imgObject,
name: 'image',
offset: {x:offX, y:offY}
})
Upvotes: 0
Views: 64
Reputation: 493
Position = translate + offset. TranslateX = X - offsetX. TranslateY = Y - offsetY. So, if you want to create the effect of an object not appearing moved (though, by the numbers, it has), then you need to add the offset to the attributes x and y.
Upvotes: 1