Reputation: 419
I have a kinetic image in my drawImage function:
var kImage = new Kinetic.Image({
id: 'myImage',
x: 200,
y: 50,
image: imageObj,
width: 106,
height: 118
});
Now, I need to put kImage as a global varible, and set x, y, id... in the drawImage function.
I did:
function drawImage() {
kImage.setX= ...
kImage.setId=...
}
but it seems that the kImage that I get in the end is "empty". kImage.getX() returns 0 for example and it is the same thing for the other fields.
Could you tell me what's wrong here please?
Thanks!
Upvotes: 1
Views: 533
Reputation: 3160
Set Coordinates
kImage.setX(x)
and kImage.setY(y)
or
kImage.setPosition(x, y)
Set ID
kImage.setId(id)
Set Offset
kImage.setOffsetX(x)
and kImage.setOffsetY(y)
or
kImage.setOffset(x, y)
Sources
Upvotes: 2