2021-10-10 13:46:10 +00:00
|
|
|
/**
|
|
|
|
* @author Greg McLean <GregDevProjects>
|
|
|
|
* @copyright 2021 Photon Storm Ltd.
|
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interpolates two given Vectors and returns a new Vector between them.
|
|
|
|
*
|
|
|
|
* Does not modify either of the passed Vectors.
|
|
|
|
*
|
|
|
|
* @function Phaser.Math.LinearXY
|
2021-11-04 16:39:24 +00:00
|
|
|
* @since 3.60.0
|
2021-10-10 13:46:10 +00:00
|
|
|
*
|
|
|
|
* @param {Phaser.Math.Vector2} vector1 - Starting vector
|
|
|
|
* @param {Phaser.Math.Vector2} vector2 - Ending vector
|
|
|
|
* @param {number} [t=0] - The percentage between vector1 and vector2 to return, represented as a number between 0 and 1.
|
|
|
|
*
|
|
|
|
* @return {Phaser.Math.Vector2} The step t% of the way between vector1 and vector2.
|
|
|
|
*/
|
|
|
|
var LinearXY = function (vector1, vector2, t)
|
|
|
|
{
|
2021-11-04 16:39:24 +00:00
|
|
|
if (t === undefined) { t = 0; }
|
|
|
|
|
2021-10-10 13:46:10 +00:00
|
|
|
return vector1.clone().lerp(vector2, t);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = LinearXY;
|