phaser/v3/src/components/Origin.js

29 lines
478 B
JavaScript
Raw Normal View History

// Origin Component
// Values are given in pixels, not percent
var Origin = {
originX: 0,
originY: 0,
setOrigin: function (x, y)
{
if (x === undefined) { x = 0; }
if (y === undefined) { y = x; }
this.originX = x;
this.originY = y;
return this;
},
setOriginToCenter: function ()
{
this.originX = this.frame.centerX;
this.originY = this.frame.centerY;
}
};
module.exports = Origin;