phaser/v3/src/math/Rotate.js

15 lines
308 B
JavaScript
Raw Normal View History

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