File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ) ) ;
You can’t perform that action at this time.
0 commit comments