Skip to content

Commit 9e2ca08

Browse files
committed
Added factorial and changed interpolation docs
1 parent 3ebb13c commit 9e2ca08

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

src/math/Math.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ Phaser.Math = {
856856
/**
857857
* A Bezier Interpolation Method, mostly used by Phaser.Tween.
858858
* @method Phaser.Math#bezierInterpolation
859-
* @param {number} v
859+
* @param {Array} v
860860
* @param {number} k
861861
* @return {number}
862862
*/
@@ -877,7 +877,7 @@ Phaser.Math = {
877877
/**
878878
* A Catmull Rom Interpolation Method, mostly used by Phaser.Tween.
879879
* @method Phaser.Math#catmullRomInterpolation
880-
* @param {number} v
880+
* @param {Array} v
881881
* @param {number} k
882882
* @return {number}
883883
*/
@@ -936,6 +936,24 @@ Phaser.Math = {
936936
return this.factorial(n) / this.factorial(i) / this.factorial(n - i);
937937
},
938938

939+
/**
940+
* @method Phaser.Math#factorial
941+
* @param {number} value - the number you want to evaluate
942+
* @return {number}
943+
*/
944+
factorial : function( value ){
945+
if(value == 0) return 1;
946+
947+
var res = value;
948+
949+
while( --value )
950+
{
951+
res *= value;
952+
}
953+
954+
return res;
955+
},
956+
939957
/**
940958
* Description.
941959
* @method Phaser.Math#catmullRom
@@ -1364,4 +1382,4 @@ Phaser.Math = {
13641382

13651383
}())
13661384

1367-
};
1385+
};

0 commit comments

Comments
 (0)