yeet
This commit is contained in:
34
node_modules/react-native-reanimated/lib/module/animations/Animation.js
generated
vendored
Normal file
34
node_modules/react-native-reanimated/lib/module/animations/Animation.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import AnimatedValue from '../core/InternalAnimatedValue';
|
||||
|
||||
class Animation {
|
||||
static springDefaultState() {
|
||||
return {
|
||||
position: new AnimatedValue(0),
|
||||
finished: new AnimatedValue(0),
|
||||
velocity: new AnimatedValue(0),
|
||||
time: new AnimatedValue(0)
|
||||
};
|
||||
}
|
||||
|
||||
static decayDefaultState() {
|
||||
return {
|
||||
position: new AnimatedValue(0),
|
||||
finished: new AnimatedValue(0),
|
||||
velocity: new AnimatedValue(0),
|
||||
time: new AnimatedValue(0)
|
||||
};
|
||||
}
|
||||
|
||||
static timingDefaultState() {
|
||||
return {
|
||||
position: new AnimatedValue(0),
|
||||
finished: new AnimatedValue(0),
|
||||
time: new AnimatedValue(0),
|
||||
frameTime: new AnimatedValue(0)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Animation;
|
||||
//# sourceMappingURL=Animation.js.map
|
1
node_modules/react-native-reanimated/lib/module/animations/Animation.js.map
generated
vendored
Normal file
1
node_modules/react-native-reanimated/lib/module/animations/Animation.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["Animation.js"],"names":["AnimatedValue","Animation","springDefaultState","position","finished","velocity","time","decayDefaultState","timingDefaultState","frameTime"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,+BAA1B;;AAEA,MAAMC,SAAN,CAAgB;AACd,SAAOC,kBAAP,GAA4B;AAC1B,WAAO;AACLC,MAAAA,QAAQ,EAAE,IAAIH,aAAJ,CAAkB,CAAlB,CADL;AAELI,MAAAA,QAAQ,EAAE,IAAIJ,aAAJ,CAAkB,CAAlB,CAFL;AAGLK,MAAAA,QAAQ,EAAE,IAAIL,aAAJ,CAAkB,CAAlB,CAHL;AAILM,MAAAA,IAAI,EAAE,IAAIN,aAAJ,CAAkB,CAAlB;AAJD,KAAP;AAMD;;AAED,SAAOO,iBAAP,GAA2B;AACzB,WAAO;AACLJ,MAAAA,QAAQ,EAAE,IAAIH,aAAJ,CAAkB,CAAlB,CADL;AAELI,MAAAA,QAAQ,EAAE,IAAIJ,aAAJ,CAAkB,CAAlB,CAFL;AAGLK,MAAAA,QAAQ,EAAE,IAAIL,aAAJ,CAAkB,CAAlB,CAHL;AAILM,MAAAA,IAAI,EAAE,IAAIN,aAAJ,CAAkB,CAAlB;AAJD,KAAP;AAMD;;AAED,SAAOQ,kBAAP,GAA4B;AAC1B,WAAO;AACLL,MAAAA,QAAQ,EAAE,IAAIH,aAAJ,CAAkB,CAAlB,CADL;AAELI,MAAAA,QAAQ,EAAE,IAAIJ,aAAJ,CAAkB,CAAlB,CAFL;AAGLM,MAAAA,IAAI,EAAE,IAAIN,aAAJ,CAAkB,CAAlB,CAHD;AAILS,MAAAA,SAAS,EAAE,IAAIT,aAAJ,CAAkB,CAAlB;AAJN,KAAP;AAMD;;AA1Ba;;AA6BhB,eAAeC,SAAf","sourcesContent":["import AnimatedValue from '../core/InternalAnimatedValue';\n\nclass Animation {\n static springDefaultState() {\n return {\n position: new AnimatedValue(0),\n finished: new AnimatedValue(0),\n velocity: new AnimatedValue(0),\n time: new AnimatedValue(0),\n };\n }\n\n static decayDefaultState() {\n return {\n position: new AnimatedValue(0),\n finished: new AnimatedValue(0),\n velocity: new AnimatedValue(0),\n time: new AnimatedValue(0),\n };\n }\n\n static timingDefaultState() {\n return {\n position: new AnimatedValue(0),\n finished: new AnimatedValue(0),\n time: new AnimatedValue(0),\n frameTime: new AnimatedValue(0),\n };\n }\n}\n\nexport default Animation;\n"]}
|
168
node_modules/react-native-reanimated/lib/module/animations/SpringUtils.js
generated
vendored
Normal file
168
node_modules/react-native-reanimated/lib/module/animations/SpringUtils.js
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
import { cond, sub, divide, multiply, add, pow, lessOrEq, and, greaterThan } from './../base';
|
||||
import AnimatedValue from './../core/InternalAnimatedValue';
|
||||
|
||||
function stiffnessFromOrigamiValue(oValue) {
|
||||
return (oValue - 30) * 3.62 + 194;
|
||||
}
|
||||
|
||||
function dampingFromOrigamiValue(oValue) {
|
||||
return (oValue - 8) * 3 + 25;
|
||||
}
|
||||
|
||||
function stiffnessFromOrigamiNode(oValue) {
|
||||
return add(multiply(sub(oValue, 30), 3.62), 194);
|
||||
}
|
||||
|
||||
function dampingFromOrigamiNode(oValue) {
|
||||
return add(multiply(sub(oValue, 8), 3), 25);
|
||||
}
|
||||
|
||||
function makeConfigFromOrigamiTensionAndFriction(prevConfig) {
|
||||
const {
|
||||
tension,
|
||||
friction
|
||||
} = prevConfig,
|
||||
rest = _objectWithoutProperties(prevConfig, ["tension", "friction"]);
|
||||
|
||||
return _objectSpread(_objectSpread({}, rest), {}, {
|
||||
stiffness: typeof tension === 'number' ? stiffnessFromOrigamiValue(tension) : stiffnessFromOrigamiNode(tension),
|
||||
damping: typeof friction === 'number' ? dampingFromOrigamiValue(friction) : dampingFromOrigamiNode(friction)
|
||||
});
|
||||
}
|
||||
|
||||
function makeConfigFromBouncinessAndSpeed(prevConfig) {
|
||||
const {
|
||||
bounciness,
|
||||
speed
|
||||
} = prevConfig,
|
||||
rest = _objectWithoutProperties(prevConfig, ["bounciness", "speed"]);
|
||||
|
||||
if (typeof bounciness === 'number' && typeof speed === 'number') {
|
||||
return fromBouncinessAndSpeedNumbers(bounciness, speed, rest);
|
||||
}
|
||||
|
||||
return fromBouncinessAndSpeedNodes(bounciness, speed, rest);
|
||||
}
|
||||
|
||||
function fromBouncinessAndSpeedNodes(bounciness, speed, rest) {
|
||||
function normalize(value, startValue, endValue) {
|
||||
return divide(sub(value, startValue), sub(endValue, startValue));
|
||||
}
|
||||
|
||||
function projectNormal(n, start, end) {
|
||||
return add(start, multiply(n, sub(end, start)));
|
||||
}
|
||||
|
||||
function linearInterpolation(t, start, end) {
|
||||
return add(multiply(t, end), multiply(sub(1, t), start));
|
||||
}
|
||||
|
||||
function quadraticOutInterpolation(t, start, end) {
|
||||
return linearInterpolation(sub(multiply(2, t), multiply(t, t)), start, end);
|
||||
}
|
||||
|
||||
function b3Friction1(x) {
|
||||
return add(sub(multiply(0.0007, pow(x, 3)), multiply(0.031, pow(x, 2))), multiply(0.64, x), 1.28);
|
||||
}
|
||||
|
||||
function b3Friction2(x) {
|
||||
return add(sub(multiply(0.000044, pow(x, 3)), multiply(0.006, pow(x, 2))), multiply(0.36, x), 2);
|
||||
}
|
||||
|
||||
function b3Friction3(x) {
|
||||
return add(sub(multiply(0.00000045, pow(x, 3)), multiply(0.000332, pow(x, 2))), multiply(0.1078, x), 5.84);
|
||||
}
|
||||
|
||||
function b3Nobounce(tension) {
|
||||
return cond(lessOrEq(tension, 18), b3Friction1(tension), cond(and(greaterThan(tension, 18), lessOrEq(tension, 44)), b3Friction2(tension), b3Friction3(tension)));
|
||||
}
|
||||
|
||||
let b = normalize(divide(bounciness, 1.7), 0, 20);
|
||||
b = projectNormal(b, 0, 0.8);
|
||||
const s = normalize(divide(speed, 1.7), 0, 20);
|
||||
const bouncyTension = projectNormal(s, 0.5, 200);
|
||||
const bouncyFriction = quadraticOutInterpolation(b, b3Nobounce(bouncyTension), 0.01);
|
||||
return _objectSpread(_objectSpread({}, rest), {}, {
|
||||
stiffness: stiffnessFromOrigamiNode(bouncyTension),
|
||||
damping: dampingFromOrigamiNode(bouncyFriction)
|
||||
});
|
||||
}
|
||||
|
||||
function fromBouncinessAndSpeedNumbers(bounciness, speed, rest) {
|
||||
function normalize(value, startValue, endValue) {
|
||||
return (value - startValue) / (endValue - startValue);
|
||||
}
|
||||
|
||||
function projectNormal(n, start, end) {
|
||||
return start + n * (end - start);
|
||||
}
|
||||
|
||||
function linearInterpolation(t, start, end) {
|
||||
return t * end + (1 - t) * start;
|
||||
}
|
||||
|
||||
function quadraticOutInterpolation(t, start, end) {
|
||||
return linearInterpolation(2 * t - t * t, start, end);
|
||||
}
|
||||
|
||||
function b3Friction1(x) {
|
||||
return 0.0007 * Math.pow(x, 3) - 0.031 * Math.pow(x, 2) + 0.64 * x + 1.28;
|
||||
}
|
||||
|
||||
function b3Friction2(x) {
|
||||
return 0.000044 * Math.pow(x, 3) - 0.006 * Math.pow(x, 2) + 0.36 * x + 2;
|
||||
}
|
||||
|
||||
function b3Friction3(x) {
|
||||
return 0.00000045 * Math.pow(x, 3) - 0.000332 * Math.pow(x, 2) + 0.1078 * x + 5.84;
|
||||
}
|
||||
|
||||
function b3Nobounce(tension) {
|
||||
if (tension <= 18) {
|
||||
return b3Friction1(tension);
|
||||
} else if (tension > 18 && tension <= 44) {
|
||||
return b3Friction2(tension);
|
||||
} else {
|
||||
return b3Friction3(tension);
|
||||
}
|
||||
}
|
||||
|
||||
let b = normalize(bounciness / 1.7, 0, 20);
|
||||
b = projectNormal(b, 0, 0.8);
|
||||
const s = normalize(speed / 1.7, 0, 20);
|
||||
const bouncyTension = projectNormal(s, 0.5, 200);
|
||||
const bouncyFriction = quadraticOutInterpolation(b, b3Nobounce(bouncyTension), 0.01);
|
||||
return _objectSpread(_objectSpread({}, rest), {}, {
|
||||
stiffness: stiffnessFromOrigamiValue(bouncyTension),
|
||||
damping: dampingFromOrigamiValue(bouncyFriction)
|
||||
});
|
||||
}
|
||||
|
||||
function makeDefaultConfig() {
|
||||
return {
|
||||
stiffness: new AnimatedValue(100),
|
||||
mass: new AnimatedValue(1),
|
||||
damping: new AnimatedValue(10),
|
||||
overshootClamping: false,
|
||||
restSpeedThreshold: 0.001,
|
||||
restDisplacementThreshold: 0.001,
|
||||
toValue: new AnimatedValue(0)
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
makeDefaultConfig,
|
||||
makeConfigFromBouncinessAndSpeed,
|
||||
makeConfigFromOrigamiTensionAndFriction
|
||||
};
|
||||
//# sourceMappingURL=SpringUtils.js.map
|
1
node_modules/react-native-reanimated/lib/module/animations/SpringUtils.js.map
generated
vendored
Normal file
1
node_modules/react-native-reanimated/lib/module/animations/SpringUtils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
102
node_modules/react-native-reanimated/lib/module/animations/backwardCompatibleAnimWrapper.js
generated
vendored
Normal file
102
node_modules/react-native-reanimated/lib/module/animations/backwardCompatibleAnimWrapper.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
import { always, block, call, clockRunning, cond, set, startClock, stopClock } from '../base';
|
||||
import Clock from '../core/AnimatedClock';
|
||||
import { evaluateOnce } from '../derived/evaluateOnce';
|
||||
|
||||
function createOldAnimationObject(node, animationStateDefaults, value, config) {
|
||||
const newClock = new Clock();
|
||||
const currentState = animationStateDefaults();
|
||||
let alwaysNode;
|
||||
let isStarted = false;
|
||||
let isDone = false;
|
||||
let wasStopped = false;
|
||||
let animationCallback;
|
||||
const animation = {
|
||||
start: currentAnimationCallback => {
|
||||
animationCallback = currentAnimationCallback;
|
||||
|
||||
if (isStarted) {
|
||||
animationCallback && animationCallback({
|
||||
finished: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDone) {
|
||||
console.warn('Animation has been finished before'); // inconsistent with React Native
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value.isNativelyInitialized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
isStarted = true;
|
||||
evaluateOnce(set(currentState.position, value), currentState.position, () => {
|
||||
alwaysNode = always(set(value, block([cond(clockRunning(newClock), 0, startClock(newClock)), node(newClock, currentState, config), cond(currentState.finished, [call([], () => {
|
||||
isStarted = false;
|
||||
|
||||
if (!wasStopped) {
|
||||
isDone = true;
|
||||
}
|
||||
|
||||
value.__detachAnimation(animation);
|
||||
|
||||
isDone = true;
|
||||
|
||||
if (!wasStopped) {
|
||||
wasStopped = false;
|
||||
}
|
||||
}), stopClock(newClock)]), currentState.position])));
|
||||
|
||||
value.__attachAnimation(animation);
|
||||
|
||||
alwaysNode.__addChild(value);
|
||||
});
|
||||
},
|
||||
__detach: () => {
|
||||
animationCallback && animationCallback({
|
||||
finished: isDone
|
||||
});
|
||||
animationCallback = null;
|
||||
value.__initialized && alwaysNode.__removeChild(value);
|
||||
},
|
||||
stop: () => {
|
||||
if (isDone) {
|
||||
console.warn('Calling stop has no effect as the animation has already completed');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isStarted) {
|
||||
console.warn("Calling stop has no effect as the animation hasn't been started");
|
||||
return;
|
||||
}
|
||||
|
||||
wasStopped = true;
|
||||
evaluateOnce(set(currentState.finished, 1), currentState.finished);
|
||||
},
|
||||
__stopImmediately_testOnly: result => {
|
||||
animation.stop();
|
||||
isDone = result;
|
||||
|
||||
value.__detachAnimation(animation);
|
||||
}
|
||||
};
|
||||
return animation;
|
||||
}
|
||||
/**
|
||||
* Depending on the arguments list we either return animation node or return an
|
||||
* animation object that is compatible with the original Animated API
|
||||
*/
|
||||
|
||||
|
||||
export default function backwardsCompatibleAnimWrapper(node, animationStateDefaults) {
|
||||
return (clock, state, config) => {
|
||||
if (config !== undefined) {
|
||||
return node(clock, state, config);
|
||||
}
|
||||
|
||||
return createOldAnimationObject(node, animationStateDefaults, clock, state);
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=backwardCompatibleAnimWrapper.js.map
|
1
node_modules/react-native-reanimated/lib/module/animations/backwardCompatibleAnimWrapper.js.map
generated
vendored
Normal file
1
node_modules/react-native-reanimated/lib/module/animations/backwardCompatibleAnimWrapper.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
36
node_modules/react-native-reanimated/lib/module/animations/decay.js
generated
vendored
Normal file
36
node_modules/react-native-reanimated/lib/module/animations/decay.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
import { cond, sub, pow, divide, multiply, add, block, set, lessThan, proc, abs } from '../base';
|
||||
const VELOCITY_EPS = 5;
|
||||
|
||||
function decay(clock, state, config) {
|
||||
const lastTime = cond(state.time, state.time, clock);
|
||||
const deltaTime = sub(clock, lastTime); // v0 = v / 1000
|
||||
// v = v0 * powf(deceleration, dt);
|
||||
// v = v * 1000;
|
||||
// x0 = x;
|
||||
// x = x0 + v0 * deceleration * (1 - powf(deceleration, dt)) / (1 - deceleration)
|
||||
|
||||
const kv = pow(config.deceleration, deltaTime);
|
||||
const kx = divide(multiply(config.deceleration, sub(1, kv)), sub(1, config.deceleration));
|
||||
const v0 = divide(state.velocity, 1000);
|
||||
const v = multiply(v0, kv, 1000);
|
||||
const x = add(state.position, multiply(v0, kx));
|
||||
return block([set(state.position, x), set(state.velocity, v), set(state.time, clock), cond(lessThan(abs(v), VELOCITY_EPS), set(state.finished, 1))]);
|
||||
}
|
||||
|
||||
const procDecay = proc((clock, time, velocity, position, finished, deceleration) => decay(clock, {
|
||||
time,
|
||||
velocity,
|
||||
position,
|
||||
finished
|
||||
}, {
|
||||
deceleration
|
||||
}));
|
||||
export default ((clock, {
|
||||
time,
|
||||
velocity,
|
||||
position,
|
||||
finished
|
||||
}, {
|
||||
deceleration
|
||||
}) => procDecay(clock, time, velocity, position, finished, deceleration));
|
||||
//# sourceMappingURL=decay.js.map
|
1
node_modules/react-native-reanimated/lib/module/animations/decay.js.map
generated
vendored
Normal file
1
node_modules/react-native-reanimated/lib/module/animations/decay.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["decay.js"],"names":["cond","sub","pow","divide","multiply","add","block","set","lessThan","proc","abs","VELOCITY_EPS","decay","clock","state","config","lastTime","time","deltaTime","kv","deceleration","kx","v0","velocity","v","x","position","finished","procDecay"],"mappings":"AAAA,SACEA,IADF,EAEEC,GAFF,EAGEC,GAHF,EAIEC,MAJF,EAKEC,QALF,EAMEC,GANF,EAOEC,KAPF,EAQEC,GARF,EASEC,QATF,EAUEC,IAVF,EAWEC,GAXF,QAYO,SAZP;AAcA,MAAMC,YAAY,GAAG,CAArB;;AAEA,SAASC,KAAT,CAAeC,KAAf,EAAsBC,KAAtB,EAA6BC,MAA7B,EAAqC;AACnC,QAAMC,QAAQ,GAAGhB,IAAI,CAACc,KAAK,CAACG,IAAP,EAAaH,KAAK,CAACG,IAAnB,EAAyBJ,KAAzB,CAArB;AACA,QAAMK,SAAS,GAAGjB,GAAG,CAACY,KAAD,EAAQG,QAAR,CAArB,CAFmC,CAInC;AACA;AACA;AAEA;AACA;;AACA,QAAMG,EAAE,GAAGjB,GAAG,CAACa,MAAM,C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,EAAAA,QAAlB;AAA4BC,EAAAA;AAA5B,CAFa,EAGb;AAAEP,EAAAA;AAAF,CAHa,KAIVQ,SAAS,CAACf,KAAD,EAAQI,IAAR,EAAcM,QAAd,EAAwBG,QAAxB,EAAkCC,QAAlC,EAA4CP,YAA5C,CAJd","sourcesContent":["import {\n cond,\n sub,\n pow,\n divide,\n multiply,\n add,\n block,\n set,\n lessThan,\n proc,\n abs,\n} from '../base';\n\nconst VELOCITY_EPS = 5;\n\nfunction decay(clock, state, config) {\n const lastTime = cond(state.time, state.time, clock);\n const deltaTime = sub(clock, lastTime);\n\n // v0 = v / 1000\n // v = v0 * powf(deceleration, dt);\n // v = v * 1000;\n\n // x0 = x;\n // x = x0 + v0 * deceleration * (1 - powf(deceleration, dt)) / (1 - deceleration)\n const kv = pow(config.deceleration, deltaTime);\n const kx = divide(\n multiply(config.deceleration, sub(1, kv)),\n sub(1, config.deceleration)\n );\n const v0 = divide(state.velocity, 1000);\n const v = multiply(v0, kv, 1000);\n const x = add(state.position, multiply(v0, kx));\n return block([\n set(state.position, x),\n set(state.velocity, v),\n set(state.time, clock),\n cond(lessThan(abs(v), VELOCITY_EPS), set(state.finished, 1)),\n ]);\n}\n\nconst procDecay = proc(\n (clock, time, velocity, position, finished, deceleration) =>\n decay(clock, { time, velocity, position, finished }, { deceleration })\n);\n\nexport default (\n clock,\n { time, velocity, position, finished },\n { deceleration }\n) => procDecay(clock, time, velocity, position, finished, deceleration);\n"]}
|
73
node_modules/react-native-reanimated/lib/module/animations/spring.js
generated
vendored
Normal file
73
node_modules/react-native-reanimated/lib/module/animations/spring.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
import { cond, sub, divide, multiply, sqrt, add, block, set, exp, sin, cos, eq, or, neq, and, lessThan, greaterThan, proc, min, abs } from '../base';
|
||||
import AnimatedValue from '../core/InternalAnimatedValue';
|
||||
const MAX_STEPS_MS = 64;
|
||||
|
||||
function spring(clock, state, config) {
|
||||
const lastTime = cond(state.time, state.time, clock);
|
||||
const deltaTime = min(sub(clock, lastTime), MAX_STEPS_MS);
|
||||
const c = config.damping;
|
||||
const m = config.mass;
|
||||
const k = config.stiffness;
|
||||
const v0 = multiply(-1, state.velocity);
|
||||
const x0 = sub(config.toValue, state.position);
|
||||
const zeta = divide(c, multiply(2, sqrt(multiply(k, m)))); // damping ratio
|
||||
|
||||
const omega0 = sqrt(divide(k, m)); // undamped angular frequency of the oscillator (rad/ms)
|
||||
|
||||
const omega1 = multiply(omega0, sqrt(sub(1, multiply(zeta, zeta)))); // exponential decay
|
||||
|
||||
const t = divide(deltaTime, 1000); // in seconds
|
||||
|
||||
const sin1 = sin(multiply(omega1, t));
|
||||
const cos1 = cos(multiply(omega1, t)); // under damped
|
||||
|
||||
const underDampedEnvelope = exp(multiply(-1, zeta, omega0, t));
|
||||
const underDampedFrag1 = multiply(underDampedEnvelope, add(multiply(sin1, divide(add(v0, multiply(zeta, omega0, x0)), omega1)), multiply(x0, cos1)));
|
||||
const underDampedPosition = sub(config.toValue, underDampedFrag1); // This looks crazy -- it's actually just the derivative of the oscillation function
|
||||
|
||||
const underDampedVelocity = sub(multiply(zeta, omega0, underDampedFrag1), multiply(underDampedEnvelope, sub(multiply(cos1, add(v0, multiply(zeta, omega0, x0))), multiply(omega1, x0, sin1)))); // critically damped
|
||||
|
||||
const criticallyDampedEnvelope = exp(multiply(-1, omega0, t));
|
||||
const criticallyDampedPosition = sub(config.toValue, multiply(criticallyDampedEnvelope, add(x0, multiply(add(v0, multiply(omega0, x0)), t))));
|
||||
const criticallyDampedVelocity = multiply(criticallyDampedEnvelope, add(multiply(v0, sub(multiply(t, omega0), 1)), multiply(t, x0, omega0, omega0))); // conditions for stopping the spring animations
|
||||
|
||||
const prevPosition = state.prevPosition ? state.prevPosition : new AnimatedValue(0);
|
||||
const isOvershooting = cond(and(config.overshootClamping, neq(config.stiffness, 0)), cond(lessThan(prevPosition, config.toValue), greaterThan(state.position, config.toValue), lessThan(state.position, config.toValue)));
|
||||
const isVelocity = lessThan(abs(state.velocity), config.restSpeedThreshold);
|
||||
const isDisplacement = or(eq(config.stiffness, 0), lessThan(abs(sub(config.toValue, state.position)), config.restDisplacementThreshold));
|
||||
return block([set(prevPosition, state.position), cond(lessThan(zeta, 1), [set(state.position, underDampedPosition), set(state.velocity, underDampedVelocity)], [set(state.position, criticallyDampedPosition), set(state.velocity, criticallyDampedVelocity)]), set(state.time, clock), cond(or(isOvershooting, and(isVelocity, isDisplacement)), [cond(neq(config.stiffness, 0), [set(state.velocity, 0), set(state.position, config.toValue)]), set(state.finished, 1)])]);
|
||||
}
|
||||
|
||||
const procSpring = proc((finished, velocity, position, time, prevPosition, toValue, damping, mass, stiffness, overshootClamping, restSpeedThreshold, restDisplacementThreshold, clock) => spring(clock, {
|
||||
finished,
|
||||
velocity,
|
||||
position,
|
||||
time,
|
||||
// @ts-ignore
|
||||
prevPosition
|
||||
}, {
|
||||
toValue,
|
||||
damping,
|
||||
mass,
|
||||
stiffness,
|
||||
overshootClamping,
|
||||
restDisplacementThreshold,
|
||||
restSpeedThreshold
|
||||
}));
|
||||
export default ((clock, {
|
||||
finished,
|
||||
velocity,
|
||||
position,
|
||||
time,
|
||||
// @ts-ignore
|
||||
prevPosition
|
||||
}, {
|
||||
toValue,
|
||||
damping,
|
||||
mass,
|
||||
stiffness,
|
||||
overshootClamping,
|
||||
restDisplacementThreshold,
|
||||
restSpeedThreshold
|
||||
}) => procSpring(finished, velocity, position, time, prevPosition, toValue, damping, mass, stiffness, overshootClamping, restSpeedThreshold, restDisplacementThreshold, clock));
|
||||
//# sourceMappingURL=spring.js.map
|
1
node_modules/react-native-reanimated/lib/module/animations/spring.js.map
generated
vendored
Normal file
1
node_modules/react-native-reanimated/lib/module/animations/spring.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
31
node_modules/react-native-reanimated/lib/module/animations/timing.js
generated
vendored
Normal file
31
node_modules/react-native-reanimated/lib/module/animations/timing.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
import { cond, sub, divide, multiply, add, block, set, greaterOrEq, proc } from '../base';
|
||||
const internalTiming = proc(function (clock, time, frameTime, position, finished, toValue, duration, nextProgress, progress, newFrameTime) {
|
||||
const state = {
|
||||
time,
|
||||
finished,
|
||||
frameTime,
|
||||
position
|
||||
};
|
||||
const config = {
|
||||
duration,
|
||||
toValue
|
||||
};
|
||||
const distanceLeft = sub(config.toValue, state.position);
|
||||
const fullDistance = divide(distanceLeft, sub(1, progress));
|
||||
const startPosition = sub(config.toValue, fullDistance);
|
||||
const nextPosition = add(startPosition, multiply(fullDistance, nextProgress));
|
||||
return block([cond(greaterOrEq(newFrameTime, config.duration), [set(state.position, config.toValue), set(state.finished, 1)], set(state.position, nextPosition)), set(state.frameTime, newFrameTime), set(state.time, clock)]);
|
||||
});
|
||||
export default function (clock, state, config) {
|
||||
if (config.duration === 0) {
|
||||
// when duration is zero we end the timing immediately
|
||||
return block([set(state.position, config.toValue), set(state.finished, 1)]);
|
||||
}
|
||||
|
||||
const lastTime = cond(state.time, state.time, clock);
|
||||
const newFrameTime = add(state.frameTime, sub(clock, lastTime));
|
||||
const nextProgress = config.easing(divide(newFrameTime, config.duration));
|
||||
const progress = config.easing(divide(state.frameTime, config.duration));
|
||||
return internalTiming(clock, state.time, state.frameTime, state.position, state.finished, config.toValue, config.duration, nextProgress, progress, newFrameTime);
|
||||
}
|
||||
//# sourceMappingURL=timing.js.map
|
1
node_modules/react-native-reanimated/lib/module/animations/timing.js.map
generated
vendored
Normal file
1
node_modules/react-native-reanimated/lib/module/animations/timing.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["timing.js"],"names":["cond","sub","divide","multiply","add","block","set","greaterOrEq","proc","internalTiming","clock","time","frameTime","position","finished","toValue","duration","nextProgress","progress","newFrameTime","state","config","distanceLeft","fullDistance","startPosition","nextPosition","lastTime","easing"],"mappings":"AAAA,SACEA,IADF,EAEEC,GAFF,EAGEC,MAHF,EAIEC,QAJF,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AP,EAAaD,KAAb,CAPQ,CAAD,CAAZ;AASD,CAtC0B,CAA3B;AAwCA,eAAe,UAASA,KAAT,EAAgBU,KAAhB,EAAuBC,MAAvB,EAA+B;AAC5C,MAAIA,MAAM,CAACL,QAAP,KAAoB,CAAxB,EAA2B;AACzB;AACA,WAAOX,KAAK,CAAC,CAACC,GAAG,CAACc,KAAK,CAACP,QAAP,EAAiBQ,MAAM,CAACN,OAAxB,CAAJ,EAAsCT,GAAG,CAACc,KAAK,CAACN,QAAP,EAAiB,CAAjB,CAAzC,CAAD,CAAZ;AACD;;AACD,QAAMY,QAAQ,GAAG1B,IAAI,CAACoB,KAAK,CAACT,IAAP,EAAaS,KAAK,CAACT,IAAnB,EAAyBD,KAAzB,CAArB;AACA,QAAMS,YAAY,GAAGf,GAAG,CAACgB,KAAK,CAACR,SAAP,EAAkBX,GAAG,CAACS,KAAD,EAAQgB,QAAR,CAArB,CAAxB;AACA,QAAMT,YAAY,GAAGI,MAAM,CAACM,MAAP,CAAczB,MAAM,CAACiB,YAAD,EAAeE,MAAM,CAACL,QAAtB,CAApB,CAArB;AACA,QAAME,QAAQ,GAAGG,MAAM,CAACM,MAAP,CAAczB,MAAM,CAACkB,KAAK,CAACR,SAAP,EAAkBS,MAAM,CAACL,QAAzB,CAApB,CAAjB;AACA,SAAOP,cAAc,CACnBC,KADmB,EAEnBU,KAAK,CAACT,IAFa,EAGnBS,KAAK,CAACR,SAHa,EAInBQ,KAAK,CAACP,QAJa,EAKnBO,KAAK,CAACN,QALa,EAMnBO,MAAM,CAACN,OANY,EAOnBM,MAAM,CAACL,QAPY,EAQnBC,YARmB,EASnBC,QATmB,EAUnBC,YAVmB,CAArB;AAYD","sourcesContent":["import {\n cond,\n sub,\n divide,\n multiply,\n add,\n block,\n set,\n greaterOrEq,\n proc,\n} from '../base';\n\nconst internalTiming = proc(function(\n clock,\n time,\n frameTime,\n position,\n finished,\n toValue,\n duration,\n nextProgress,\n progress,\n newFrameTime\n) {\n const state = {\n time,\n finished,\n frameTime,\n position,\n };\n\n const config = {\n duration,\n toValue,\n };\n\n const distanceLeft = sub(config.toValue, state.position);\n const fullDistance = divide(distanceLeft, sub(1, progress));\n const startPosition = sub(config.toValue, fullDistance);\n const nextPosition = add(startPosition, multiply(fullDistance, nextProgress));\n\n return block([\n cond(\n greaterOrEq(newFrameTime, config.duration),\n [set(state.position, config.toValue), set(state.finished, 1)],\n set(state.position, nextPosition)\n ),\n set(state.frameTime, newFrameTime),\n set(state.time, clock),\n ]);\n});\n\nexport default function(clock, state, config) {\n if (config.duration === 0) {\n // when duration is zero we end the timing immediately\n return block([set(state.position, config.toValue), set(state.finished, 1)]);\n }\n const lastTime = cond(state.time, state.time, clock);\n const newFrameTime = add(state.frameTime, sub(clock, lastTime));\n const nextProgress = config.easing(divide(newFrameTime, config.duration));\n const progress = config.easing(divide(state.frameTime, config.duration));\n return internalTiming(\n clock,\n state.time,\n state.frameTime,\n state.position,\n state.finished,\n config.toValue,\n config.duration,\n nextProgress,\n progress,\n newFrameTime\n );\n}\n"]}
|
Reference in New Issue
Block a user