-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename function, move it to Math class
- Loading branch information
1 parent
1d009f8
commit e5af0a0
Showing
3 changed files
with
30 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @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. | ||
* | ||
* @method Phaser.Math.LinearXY | ||
* @since 3.6.0 | ||
* | ||
* @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} Value of the interpolation | ||
*/ | ||
var LinearXY = function (vector1, vector2, t) | ||
{ | ||
if (t === undefined) | ||
{ | ||
t = 0; | ||
} | ||
return vector1.clone().lerp(vector2, t); | ||
}; | ||
|
||
module.exports = LinearXY; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters