I'm reading some tutorials about pixi.js and I can't understand the result I got from toLocal. I expect the result to be 100,100 however I got 200,200.
Console output:
bunny1: 100 100
bunny2: 200 200
200 200
Code:
// create our little bunny friend..S
var bunny = new PIXI.Sprite(texture);
bunny.interactive = true;
bunny.buttonMode = true;
bunny.anchor.set(0.5);
bunny.scale.set(1);
bunny.x = 100;
bunny.y = 100;
// create our little bunny friend..S
var bunny2 = new PIXI.Sprite(texture);
bunny2.interactive = true;
bunny2.buttonMode = true;
bunny2.anchor.set(0.5);
bunny2.scale.set(1);
bunny2.x = 200;
bunny2.y = 200;
// add it to the stage
app.stage.addChild(bunny);
app.stage.addChild(bunny2);
console.log("bunny1:",bunny.x,bunny.y)
console.log("bunny2:",bunny2.x,bunny2.y)
console.log(bunny.toLocal(bunny.position, bunny2).x,bunny.toLocal(bunny.position, bunny2).y)