PIXI: Pivot

An example of the Pivot point altering the x and y position

HTML

<script src="https://rawgithub.com/GoodBoyDigital/pixi.js/master/bin/pixi.js"></script>

      <div align="center">
         <canvas id="game-canvas" width="400" height="400"></canvas>
      </div>

JavaScript

var stage = new PIXI.Container(0x66FF99);
	var renderer = PIXI.autoDetectRenderer(
			400,
			400, {
			view : document.getElementById("game-canvas")
		});


var square1 = new PIXI.Graphics();
//Red
square1.lineStyle(5, 0xFF0000);
square1.drawRect(100, 100, 100, 100);

var square2 = new PIXI.Graphics();
//Green
square2.lineStyle(5, 0x00FF00);
square2.drawRect(100, 100, 100, 100);
square2.pivot.x = 50;
square2.pivot.y = 50;

stage.addChild(square1);
stage.addChild(square2);
render();


function render() {
    requestAnimationFrame(render);
    renderer.render(stage);
};