2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2017-10-06 03:52:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @function Phaser.Math.Rotate
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-03-20 15:06:30 +00:00
|
|
|
* @param {(Phaser.Geom.Point|object)} point - [description]
|
2017-10-06 03:52:41 +00:00
|
|
|
* @param {number} angle - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Geom.Point} [description]
|
|
|
|
*/
|
2017-01-03 22:47:26 +00:00
|
|
|
var Rotate = function (point, angle)
|
2016-12-07 17:16:59 +00:00
|
|
|
{
|
2017-01-03 22:47:26 +00:00
|
|
|
var x = point.x;
|
|
|
|
var y = point.y;
|
2016-12-07 17:16:59 +00:00
|
|
|
|
2017-01-03 22:47:26 +00:00
|
|
|
point.x = (x * Math.cos(angle)) - (y * Math.sin(angle));
|
|
|
|
point.y = (x * Math.sin(angle)) + (y * Math.cos(angle));
|
2016-12-07 17:16:59 +00:00
|
|
|
|
2017-01-03 22:47:26 +00:00
|
|
|
return point;
|
2016-12-07 17:16:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Rotate;
|