mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 20:13:35 +00:00
28 lines
594 B
JavaScript
28 lines
594 B
JavaScript
/**
|
|
* [description]
|
|
*
|
|
* @function Phaser.Math.RotateAround
|
|
* @since 3.0.0
|
|
*
|
|
* @param {Phaser.Geom.Point|object} point - [description]
|
|
* @param {number} x - [description]
|
|
* @param {number} y - [description]
|
|
* @param {number} angle - [description]
|
|
*
|
|
* @return {Phaser.Geom.Point} [description]
|
|
*/
|
|
var RotateAround = function (point, x, y, angle)
|
|
{
|
|
var c = Math.cos(angle);
|
|
var s = Math.sin(angle);
|
|
|
|
var tx = point.x - x;
|
|
var ty = point.y - y;
|
|
|
|
point.x = tx * c - ty * s + x;
|
|
point.y = tx * s + ty * c + y;
|
|
|
|
return point;
|
|
};
|
|
|
|
module.exports = RotateAround;
|