phaser
Version:
A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.
35 lines (30 loc) • 865 B
JavaScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* [description]
*
* @function Phaser.Geom.Line.SetToAngle
* @since 3.0.0
*
* @generic {Phaser.Geom.Line} O - [line,$return]
*
* @param {Phaser.Geom.Line} line - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {number} angle - [description]
* @param {number} length - [description]
*
* @return {Phaser.Geom.Line} [description]
*/
var SetToAngle = function (line, x, y, angle, length)
{
line.x1 = x;
line.y1 = y;
line.x2 = x + (Math.cos(angle) * length);
line.y2 = y + (Math.sin(angle) * length);
return line;
};
module.exports = SetToAngle;