phaser/v3/src/math/Rotate.js

14 lines
275 B
JavaScript
Raw Normal View History

// p = Point or any object with public x/y properties
var Rotate = function (p, angle)
{
var x = p.x;
var y = p.y;
p.x = x * Math.cos(angle) - y * Math.sin(angle);
p.y = x * Math.sin(angle) + y * Math.cos(angle);
return p;
};
module.exports = Rotate;