mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 09:03:29 +00:00
17 lines
255 B
JavaScript
17 lines
255 B
JavaScript
|
|
||
|
var CenterOn = function (line, x, y)
|
||
|
{
|
||
|
var tx = x - ((line.x1 + line.x2) / 2);
|
||
|
var ty = y - ((line.y1 + line.y2) / 2);
|
||
|
|
||
|
line.x1 += tx;
|
||
|
line.y1 += ty;
|
||
|
|
||
|
line.x2 += tx;
|
||
|
line.y2 += ty;
|
||
|
|
||
|
return line;
|
||
|
};
|
||
|
|
||
|
module.exports = CenterOn;
|