UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

39 lines (32 loc) 934 B
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var Point = require('./Point'); /** * [description] * * @function Phaser.Geom.Point.ProjectUnit * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Point} pointA - [description] * @param {Phaser.Geom.Point} pointB - [description] * @param {Phaser.Geom.Point} [out] - [description] * * @return {Phaser.Geom.Point} [description] */ var ProjectUnit = function (pointA, pointB, out) { if (out === undefined) { out = new Point(); } var amt = ((pointA.x * pointB.x) + (pointA.y * pointB.y)); if (amt !== 0) { out.x = amt * pointB.x; out.y = amt * pointB.y; } return out; }; module.exports = ProjectUnit;