initial commit
This commit is contained in:
31
node_modules/mumath/mod.js
generated
vendored
Normal file
31
node_modules/mumath/mod.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Looping function for any framesize.
|
||||
* Like fmod.
|
||||
*
|
||||
* @module mumath/loop
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
module.exports = function (value, left, right) {
|
||||
//detect single-arg case, like mod-loop or fmod
|
||||
if (right === undefined) {
|
||||
right = left;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
//swap frame order
|
||||
if (left > right) {
|
||||
var tmp = right;
|
||||
right = left;
|
||||
left = tmp;
|
||||
}
|
||||
|
||||
var frame = right - left;
|
||||
|
||||
value = ((value + left) % frame) - left;
|
||||
if (value < left) value += frame;
|
||||
if (value > right) value -= frame;
|
||||
|
||||
return value;
|
||||
};
|
||||
Reference in New Issue
Block a user