first commit
This commit is contained in:
21
node_modules/motion-utils/dist/es/array.mjs
generated
vendored
Normal file
21
node_modules/motion-utils/dist/es/array.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
function addUniqueItem(arr, item) {
|
||||
if (arr.indexOf(item) === -1)
|
||||
arr.push(item);
|
||||
}
|
||||
function removeItem(arr, item) {
|
||||
const index = arr.indexOf(item);
|
||||
if (index > -1)
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// Adapted from array-move
|
||||
function moveItem([...arr], fromIndex, toIndex) {
|
||||
const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
|
||||
if (startIndex >= 0 && startIndex < arr.length) {
|
||||
const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
|
||||
const [item] = arr.splice(fromIndex, 1);
|
||||
arr.splice(endIndex, 0, item);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
export { addUniqueItem, moveItem, removeItem };
|
||||
9
node_modules/motion-utils/dist/es/clamp.mjs
generated
vendored
Normal file
9
node_modules/motion-utils/dist/es/clamp.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
const clamp = (min, max, v) => {
|
||||
if (v > max)
|
||||
return max;
|
||||
if (v < min)
|
||||
return min;
|
||||
return v;
|
||||
};
|
||||
|
||||
export { clamp };
|
||||
5
node_modules/motion-utils/dist/es/easing/anticipate.mjs
generated
vendored
Normal file
5
node_modules/motion-utils/dist/es/easing/anticipate.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { backIn } from './back.mjs';
|
||||
|
||||
const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
|
||||
|
||||
export { anticipate };
|
||||
9
node_modules/motion-utils/dist/es/easing/back.mjs
generated
vendored
Normal file
9
node_modules/motion-utils/dist/es/easing/back.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { cubicBezier } from './cubic-bezier.mjs';
|
||||
import { mirrorEasing } from './modifiers/mirror.mjs';
|
||||
import { reverseEasing } from './modifiers/reverse.mjs';
|
||||
|
||||
const backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
||||
const backIn = /*@__PURE__*/ reverseEasing(backOut);
|
||||
const backInOut = /*@__PURE__*/ mirrorEasing(backIn);
|
||||
|
||||
export { backIn, backInOut, backOut };
|
||||
8
node_modules/motion-utils/dist/es/easing/circ.mjs
generated
vendored
Normal file
8
node_modules/motion-utils/dist/es/easing/circ.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { mirrorEasing } from './modifiers/mirror.mjs';
|
||||
import { reverseEasing } from './modifiers/reverse.mjs';
|
||||
|
||||
const circIn = (p) => 1 - Math.sin(Math.acos(p));
|
||||
const circOut = reverseEasing(circIn);
|
||||
const circInOut = mirrorEasing(circIn);
|
||||
|
||||
export { circIn, circInOut, circOut };
|
||||
51
node_modules/motion-utils/dist/es/easing/cubic-bezier.mjs
generated
vendored
Normal file
51
node_modules/motion-utils/dist/es/easing/cubic-bezier.mjs
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { noop } from '../noop.mjs';
|
||||
|
||||
/*
|
||||
Bezier function generator
|
||||
This has been modified from Gaëtan Renaudeau's BezierEasing
|
||||
https://github.com/gre/bezier-easing/blob/master/src/index.js
|
||||
https://github.com/gre/bezier-easing/blob/master/LICENSE
|
||||
|
||||
I've removed the newtonRaphsonIterate algo because in benchmarking it
|
||||
wasn't noticeably faster than binarySubdivision, indeed removing it
|
||||
usually improved times, depending on the curve.
|
||||
I also removed the lookup table, as for the added bundle size and loop we're
|
||||
only cutting ~4 or so subdivision iterations. I bumped the max iterations up
|
||||
to 12 to compensate and this still tended to be faster for no perceivable
|
||||
loss in accuracy.
|
||||
Usage
|
||||
const easeOut = cubicBezier(.17,.67,.83,.67);
|
||||
const x = easeOut(0.5); // returns 0.627...
|
||||
*/
|
||||
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
||||
const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) *
|
||||
t;
|
||||
const subdivisionPrecision = 0.0000001;
|
||||
const subdivisionMaxIterations = 12;
|
||||
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
|
||||
let currentX;
|
||||
let currentT;
|
||||
let i = 0;
|
||||
do {
|
||||
currentT = lowerBound + (upperBound - lowerBound) / 2.0;
|
||||
currentX = calcBezier(currentT, mX1, mX2) - x;
|
||||
if (currentX > 0.0) {
|
||||
upperBound = currentT;
|
||||
}
|
||||
else {
|
||||
lowerBound = currentT;
|
||||
}
|
||||
} while (Math.abs(currentX) > subdivisionPrecision &&
|
||||
++i < subdivisionMaxIterations);
|
||||
return currentT;
|
||||
}
|
||||
function cubicBezier(mX1, mY1, mX2, mY2) {
|
||||
// If this is a linear gradient, return linear easing
|
||||
if (mX1 === mY1 && mX2 === mY2)
|
||||
return noop;
|
||||
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
||||
// If animation is at start/end, return t without easing
|
||||
return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
|
||||
}
|
||||
|
||||
export { cubicBezier };
|
||||
7
node_modules/motion-utils/dist/es/easing/ease.mjs
generated
vendored
Normal file
7
node_modules/motion-utils/dist/es/easing/ease.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { cubicBezier } from './cubic-bezier.mjs';
|
||||
|
||||
const easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1);
|
||||
const easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1);
|
||||
const easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1);
|
||||
|
||||
export { easeIn, easeInOut, easeOut };
|
||||
5
node_modules/motion-utils/dist/es/easing/modifiers/mirror.mjs
generated
vendored
Normal file
5
node_modules/motion-utils/dist/es/easing/modifiers/mirror.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Accepts an easing function and returns a new one that outputs mirrored values for
|
||||
// the second half of the animation. Turns easeIn into easeInOut.
|
||||
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
|
||||
|
||||
export { mirrorEasing };
|
||||
5
node_modules/motion-utils/dist/es/easing/modifiers/reverse.mjs
generated
vendored
Normal file
5
node_modules/motion-utils/dist/es/easing/modifiers/reverse.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Accepts an easing function and returns a new one that outputs reversed values.
|
||||
// Turns easeIn into easeOut.
|
||||
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);
|
||||
|
||||
export { reverseEasing };
|
||||
15
node_modules/motion-utils/dist/es/easing/steps.mjs
generated
vendored
Normal file
15
node_modules/motion-utils/dist/es/easing/steps.mjs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { clamp } from '../clamp.mjs';
|
||||
|
||||
function steps(numSteps, direction = "end") {
|
||||
return (progress) => {
|
||||
progress =
|
||||
direction === "end"
|
||||
? Math.min(progress, 0.999)
|
||||
: Math.max(progress, 0.001);
|
||||
const expanded = progress * numSteps;
|
||||
const rounded = direction === "end" ? Math.floor(expanded) : Math.ceil(expanded);
|
||||
return clamp(0, 1, rounded / numSteps);
|
||||
};
|
||||
}
|
||||
|
||||
export { steps };
|
||||
8
node_modules/motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs
generated
vendored
Normal file
8
node_modules/motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { wrap } from '../../wrap.mjs';
|
||||
import { isEasingArray } from './is-easing-array.mjs';
|
||||
|
||||
function getEasingForSegment(easing, i) {
|
||||
return isEasingArray(easing) ? easing[wrap(0, easing.length, i)] : easing;
|
||||
}
|
||||
|
||||
export { getEasingForSegment };
|
||||
3
node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs
generated
vendored
Normal file
3
node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
||||
|
||||
export { isBezierDefinition };
|
||||
5
node_modules/motion-utils/dist/es/easing/utils/is-easing-array.mjs
generated
vendored
Normal file
5
node_modules/motion-utils/dist/es/easing/utils/is-easing-array.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const isEasingArray = (ease) => {
|
||||
return Array.isArray(ease) && typeof ease[0] !== "number";
|
||||
};
|
||||
|
||||
export { isEasingArray };
|
||||
41
node_modules/motion-utils/dist/es/easing/utils/map.mjs
generated
vendored
Normal file
41
node_modules/motion-utils/dist/es/easing/utils/map.mjs
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { invariant } from '../../errors.mjs';
|
||||
import { noop } from '../../noop.mjs';
|
||||
import { anticipate } from '../anticipate.mjs';
|
||||
import { backIn, backInOut, backOut } from '../back.mjs';
|
||||
import { circIn, circInOut, circOut } from '../circ.mjs';
|
||||
import { cubicBezier } from '../cubic-bezier.mjs';
|
||||
import { easeIn, easeInOut, easeOut } from '../ease.mjs';
|
||||
import { isBezierDefinition } from './is-bezier-definition.mjs';
|
||||
|
||||
const easingLookup = {
|
||||
linear: noop,
|
||||
easeIn,
|
||||
easeInOut,
|
||||
easeOut,
|
||||
circIn,
|
||||
circInOut,
|
||||
circOut,
|
||||
backIn,
|
||||
backInOut,
|
||||
backOut,
|
||||
anticipate,
|
||||
};
|
||||
const isValidEasing = (easing) => {
|
||||
return typeof easing === "string";
|
||||
};
|
||||
const easingDefinitionToFunction = (definition) => {
|
||||
if (isBezierDefinition(definition)) {
|
||||
// If cubic bezier definition, create bezier curve
|
||||
invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`, "cubic-bezier-length");
|
||||
const [x1, y1, x2, y2] = definition;
|
||||
return cubicBezier(x1, y1, x2, y2);
|
||||
}
|
||||
else if (isValidEasing(definition)) {
|
||||
// Else lookup from table
|
||||
invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`, "invalid-easing-type");
|
||||
return easingLookup[definition];
|
||||
}
|
||||
return definition;
|
||||
};
|
||||
|
||||
export { easingDefinitionToFunction };
|
||||
18
node_modules/motion-utils/dist/es/errors.mjs
generated
vendored
Normal file
18
node_modules/motion-utils/dist/es/errors.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { formatErrorMessage } from './format-error-message.mjs';
|
||||
|
||||
let warning = () => { };
|
||||
let invariant = () => { };
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
warning = (check, message, errorCode) => {
|
||||
if (!check && typeof console !== "undefined") {
|
||||
console.warn(formatErrorMessage(message, errorCode));
|
||||
}
|
||||
};
|
||||
invariant = (check, message, errorCode) => {
|
||||
if (!check) {
|
||||
throw new Error(formatErrorMessage(message, errorCode));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { invariant, warning };
|
||||
7
node_modules/motion-utils/dist/es/format-error-message.mjs
generated
vendored
Normal file
7
node_modules/motion-utils/dist/es/format-error-message.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function formatErrorMessage(message, errorCode) {
|
||||
return errorCode
|
||||
? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`
|
||||
: message;
|
||||
}
|
||||
|
||||
export { formatErrorMessage };
|
||||
3
node_modules/motion-utils/dist/es/global-config.mjs
generated
vendored
Normal file
3
node_modules/motion-utils/dist/es/global-config.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const MotionGlobalConfig = {};
|
||||
|
||||
export { MotionGlobalConfig };
|
||||
28
node_modules/motion-utils/dist/es/index.mjs
generated
vendored
Normal file
28
node_modules/motion-utils/dist/es/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
export { addUniqueItem, moveItem, removeItem } from './array.mjs';
|
||||
export { clamp } from './clamp.mjs';
|
||||
export { invariant, warning } from './errors.mjs';
|
||||
export { MotionGlobalConfig } from './global-config.mjs';
|
||||
export { isNumericalString } from './is-numerical-string.mjs';
|
||||
export { isObject } from './is-object.mjs';
|
||||
export { isZeroValueString } from './is-zero-value-string.mjs';
|
||||
export { memo } from './memo.mjs';
|
||||
export { noop } from './noop.mjs';
|
||||
export { pipe } from './pipe.mjs';
|
||||
export { progress } from './progress.mjs';
|
||||
export { SubscriptionManager } from './subscription-manager.mjs';
|
||||
export { millisecondsToSeconds, secondsToMilliseconds } from './time-conversion.mjs';
|
||||
export { velocityPerSecond } from './velocity-per-second.mjs';
|
||||
export { hasWarned, warnOnce } from './warn-once.mjs';
|
||||
export { wrap } from './wrap.mjs';
|
||||
export { anticipate } from './easing/anticipate.mjs';
|
||||
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
||||
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
||||
export { cubicBezier } from './easing/cubic-bezier.mjs';
|
||||
export { easeIn, easeInOut, easeOut } from './easing/ease.mjs';
|
||||
export { mirrorEasing } from './easing/modifiers/mirror.mjs';
|
||||
export { reverseEasing } from './easing/modifiers/reverse.mjs';
|
||||
export { steps } from './easing/steps.mjs';
|
||||
export { getEasingForSegment } from './easing/utils/get-easing-for-segment.mjs';
|
||||
export { isBezierDefinition } from './easing/utils/is-bezier-definition.mjs';
|
||||
export { isEasingArray } from './easing/utils/is-easing-array.mjs';
|
||||
export { easingDefinitionToFunction } from './easing/utils/map.mjs';
|
||||
6
node_modules/motion-utils/dist/es/is-numerical-string.mjs
generated
vendored
Normal file
6
node_modules/motion-utils/dist/es/is-numerical-string.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
|
||||
*/
|
||||
const isNumericalString = (v) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v);
|
||||
|
||||
export { isNumericalString };
|
||||
5
node_modules/motion-utils/dist/es/is-object.mjs
generated
vendored
Normal file
5
node_modules/motion-utils/dist/es/is-object.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
function isObject(value) {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
export { isObject };
|
||||
6
node_modules/motion-utils/dist/es/is-zero-value-string.mjs
generated
vendored
Normal file
6
node_modules/motion-utils/dist/es/is-zero-value-string.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Check if the value is a zero value string like "0px" or "0%"
|
||||
*/
|
||||
const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v);
|
||||
|
||||
export { isZeroValueString };
|
||||
11
node_modules/motion-utils/dist/es/memo.mjs
generated
vendored
Normal file
11
node_modules/motion-utils/dist/es/memo.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
function memo(callback) {
|
||||
let result;
|
||||
return () => {
|
||||
if (result === undefined)
|
||||
result = callback();
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
export { memo };
|
||||
4
node_modules/motion-utils/dist/es/noop.mjs
generated
vendored
Normal file
4
node_modules/motion-utils/dist/es/noop.mjs
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const noop = (any) => any;
|
||||
|
||||
export { noop };
|
||||
11
node_modules/motion-utils/dist/es/pipe.mjs
generated
vendored
Normal file
11
node_modules/motion-utils/dist/es/pipe.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Pipe
|
||||
* Compose other transformers to run linearily
|
||||
* pipe(min(20), max(40))
|
||||
* @param {...functions} transformers
|
||||
* @return {function}
|
||||
*/
|
||||
const combineFunctions = (a, b) => (v) => b(a(v));
|
||||
const pipe = (...transformers) => transformers.reduce(combineFunctions);
|
||||
|
||||
export { pipe };
|
||||
19
node_modules/motion-utils/dist/es/progress.mjs
generated
vendored
Normal file
19
node_modules/motion-utils/dist/es/progress.mjs
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Progress within given range
|
||||
|
||||
Given a lower limit and an upper limit, we return the progress
|
||||
(expressed as a number 0-1) represented by the given value, and
|
||||
limit that progress to within 0-1.
|
||||
|
||||
@param [number]: Lower limit
|
||||
@param [number]: Upper limit
|
||||
@param [number]: Value to find progress within given range
|
||||
@return [number]: Progress of value within range as expressed 0-1
|
||||
*/
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const progress = (from, to, value) => {
|
||||
const toFromDifference = to - from;
|
||||
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
||||
};
|
||||
|
||||
export { progress };
|
||||
40
node_modules/motion-utils/dist/es/subscription-manager.mjs
generated
vendored
Normal file
40
node_modules/motion-utils/dist/es/subscription-manager.mjs
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { addUniqueItem, removeItem } from './array.mjs';
|
||||
|
||||
class SubscriptionManager {
|
||||
constructor() {
|
||||
this.subscriptions = [];
|
||||
}
|
||||
add(handler) {
|
||||
addUniqueItem(this.subscriptions, handler);
|
||||
return () => removeItem(this.subscriptions, handler);
|
||||
}
|
||||
notify(a, b, c) {
|
||||
const numSubscriptions = this.subscriptions.length;
|
||||
if (!numSubscriptions)
|
||||
return;
|
||||
if (numSubscriptions === 1) {
|
||||
/**
|
||||
* If there's only a single handler we can just call it without invoking a loop.
|
||||
*/
|
||||
this.subscriptions[0](a, b, c);
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < numSubscriptions; i++) {
|
||||
/**
|
||||
* Check whether the handler exists before firing as it's possible
|
||||
* the subscriptions were modified during this loop running.
|
||||
*/
|
||||
const handler = this.subscriptions[i];
|
||||
handler && handler(a, b, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
getSize() {
|
||||
return this.subscriptions.length;
|
||||
}
|
||||
clear() {
|
||||
this.subscriptions.length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
export { SubscriptionManager };
|
||||
12
node_modules/motion-utils/dist/es/time-conversion.mjs
generated
vendored
Normal file
12
node_modules/motion-utils/dist/es/time-conversion.mjs
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Converts seconds to milliseconds
|
||||
*
|
||||
* @param seconds - Time in seconds.
|
||||
* @return milliseconds - Converted time in milliseconds.
|
||||
*/
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
||||
|
||||
export { millisecondsToSeconds, secondsToMilliseconds };
|
||||
11
node_modules/motion-utils/dist/es/velocity-per-second.mjs
generated
vendored
Normal file
11
node_modules/motion-utils/dist/es/velocity-per-second.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
Convert velocity into velocity per second
|
||||
|
||||
@param [number]: Unit per frame
|
||||
@param [number]: Frame duration in ms
|
||||
*/
|
||||
function velocityPerSecond(velocity, frameDuration) {
|
||||
return frameDuration ? velocity * (1000 / frameDuration) : 0;
|
||||
}
|
||||
|
||||
export { velocityPerSecond };
|
||||
14
node_modules/motion-utils/dist/es/warn-once.mjs
generated
vendored
Normal file
14
node_modules/motion-utils/dist/es/warn-once.mjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { formatErrorMessage } from './format-error-message.mjs';
|
||||
|
||||
const warned = new Set();
|
||||
function hasWarned(message) {
|
||||
return warned.has(message);
|
||||
}
|
||||
function warnOnce(condition, message, errorCode) {
|
||||
if (condition || warned.has(message))
|
||||
return;
|
||||
console.warn(formatErrorMessage(message, errorCode));
|
||||
warned.add(message);
|
||||
}
|
||||
|
||||
export { hasWarned, warnOnce };
|
||||
6
node_modules/motion-utils/dist/es/wrap.mjs
generated
vendored
Normal file
6
node_modules/motion-utils/dist/es/wrap.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const wrap = (min, max, v) => {
|
||||
const rangeSize = max - min;
|
||||
return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;
|
||||
};
|
||||
|
||||
export { wrap };
|
||||
Reference in New Issue
Block a user