2018-05-24 16:04:02 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2019-01-15 16:20:22 +00:00
|
|
|
* @copyright 2019 Photon Storm Ltd.
|
2019-05-10 15:15:04 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
2018-05-24 16:04:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
var SmoothStep = require('../SmoothStep');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A Smooth Step interpolation method.
|
|
|
|
*
|
|
|
|
* @function Phaser.Math.Interpolation.SmoothStep
|
|
|
|
* @since 3.9.0
|
2018-05-24 17:02:53 +00:00
|
|
|
* @see {@link https://en.wikipedia.org/wiki/Smoothstep}
|
2018-05-24 16:04:02 +00:00
|
|
|
*
|
2018-05-24 18:06:57 +00:00
|
|
|
* @param {number} t - The percentage of interpolation, between 0 and 1.
|
2018-05-24 16:04:02 +00:00
|
|
|
* @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
|
|
|
|
* @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
|
|
|
|
*
|
|
|
|
* @return {number} The interpolated value.
|
|
|
|
*/
|
2018-05-24 18:06:57 +00:00
|
|
|
var SmoothStepInterpolation = function (t, min, max)
|
2018-05-24 16:04:02 +00:00
|
|
|
{
|
2018-05-24 18:06:57 +00:00
|
|
|
return min + (max - min) * SmoothStep(t, 0, 1);
|
2018-05-24 16:04:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = SmoothStepInterpolation;
|