mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 11:33:28 +00:00
14 lines
275 B
JavaScript
14 lines
275 B
JavaScript
|
// 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;
|