@phaserjs/phaser
Version:
16 lines (15 loc) • 352 B
JavaScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
export function SmoothStep(x, min, max) {
if (x <= min) {
return 0;
}
if (x >= max) {
return 1;
}
x = (x - min) / (max - min);
return x * x * (3 - 2 * x);
}