Compare commits

...

1 Commits

Author SHA1 Message Date
jywarren
21abb92d2b bugfixes 2018-11-08 14:11:03 -05:00
3 changed files with 17644 additions and 7378 deletions

25004
dist/image-sequencer.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -54,6 +54,22 @@ module.exports = function Dynamic(options,UI) {
]
}
// via P5js: https://github.com/processing/p5.js/blob/2920492842aae9a8bf1a779916893ac19d65cd38/src/math/calculation.js#L461-L472
function map(n, start1, stop1, start2, stop2, withinBounds) {
var newval = (n - start1) / (stop1 - start1) * (stop2 - start2) + start2;
if (!withinBounds) {
return newval;
}
// also via P5js: https://github.com/processing/p5.js/blob/2920492842aae9a8bf1a779916893ac19d65cd38/src/math/calculation.js#L116-L119
function constrain(n, low, high) {
return Math.max(Math.min(n, high), low);
};
if (start2 < stop2) {
return constrain(newval, start2, stop2);
} else {
return constrain(newval, stop2, start2);
}
};
function output(image,datauri,mimetype){