Skip to content

Commit b9fab96

Browse files
committed
Improved docs.
1 parent 3c4e63f commit b9fab96

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

src/math/Math.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -967,24 +967,29 @@ Phaser.Math = {
967967
* Smoothstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
968968
*
969969
* @method Phaser.Math#smoothstep
970-
* @param {number} x
971-
* @param {number} min
972-
* @param {number} max
973-
* @return {number}
970+
* @param {float} x - The input value.
971+
* @param {float} min - The left edge. Should be smaller than the right edge.
972+
* @param {float} max - The right edge.
973+
* @return {float} A value between 0 and 1.
974974
*/
975975
smoothstep: function (x, min, max) {
976+
977+
// Scale, bias and saturate x to 0..1 range
976978
x = Math.max(0, Math.min(1, (x - min) / (max - min)));
979+
980+
// Evaluate polynomial
977981
return x * x * (3 - 2 * x);
982+
978983
},
979984

980985
/**
981986
* Smootherstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
982987
*
983988
* @method Phaser.Math#smootherstep
984-
* @param {number} x
985-
* @param {number} min
986-
* @param {number} max
987-
* @return {number}
989+
* @param {float} x - The input value.
990+
* @param {float} min - The left edge. Should be smaller than the right edge.
991+
* @param {float} max - The right edge.
992+
* @return {float} A value between 0 and 1.
988993
*/
989994
smootherstep: function (x, min, max) {
990995
x = Math.max(0, Math.min(1, (x - min) / (max - min)));

0 commit comments

Comments
 (0)