Files
discord-decomp/sources/by-id/module-01687-rubberBandDecay.js
T
2026-07-28 01:06:53 +03:00

74 lines
4.6 KiB
JavaScript

/* Metro module 1687; source: unknown; dependencies: [1686] */
import * as Module01686Module from './module-01686.js'; /* Metro dependency 1686 */
function _fun18419(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#18419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1814:6, offset: 0x00e8b8c3, size: 86 bytes, params: 8, frame: 16
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {code: 'function rubberBandDecay_Pnpm_rubberBandDecayTs1(animation,now,config){const{SLOPE_FACTOR,DERIVATIVE_EPS,VELOCITY_EPS}=this.__closure;const{lastTimestamp:lastTimestamp,startTimestamp:startTimestamp,current:current,velocity:velocity}=animation;const deltaTime=Math.min(Math.max(now-lastTimestamp,0),64);const clampIndex=Math.abs(current-config.clamp[0])<Math.abs(current-config.clamp[1])?0:1;let derivative=0;if(current<config.clamp[0]||current>config.clamp[1]){derivative=current-config.clamp[clampIndex];}const v=velocity*Math.exp(-(1-config.deceleration)*(now-startTimestamp)*SLOPE_FACTOR)-derivative*config.rubberBandFactor;if(Math.abs(derivative)>DERIVATIVE_EPS){animation.springActive=true;}else if(animation.springActive){animation.current=config.clamp[clampIndex];return true;}else if(Math.abs(v)<VELOCITY_EPS){return true;}animation.current=current+v*config.velocityFactor*deltaTime/1000;animation.velocity=v;animation.lastTimestamp=now;return false;}'};
exports.rubberBandDecay = _fun18420();
function _fun18420() { // fn#18420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1814:1069, offset: 0x00e8b919, size: 115 bytes, params: 1, frame: 16
const rubberBandDecay2 = rubberBandDecay;
const object = {};
const SLOPE_FACTOR = (Module01686Module).SLOPE_FACTOR;
object.SLOPE_FACTOR = SLOPE_FACTOR;
object.DERIVATIVE_EPS = 0.1;
const VELOCITY_EPS = (Module01686Module).VELOCITY_EPS;
object.VELOCITY_EPS = VELOCITY_EPS;
rubberBandDecay2.__closure = object;
rubberBandDecay2.__workletHash = 1153024330944;
rubberBandDecay2.__initData = env0_2;
return rubberBandDecay2;
function rubberBandDecay(a0, a1, a2) { // fn#18421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1814:1086, offset: 0x00e8b98c, size: 458 bytes, params: 4, frame: 26
const lastTimestamp = a0.lastTimestamp;
const startTimestamp = a0.startTimestamp;
const current = a0.current;
const velocity = a0.velocity;
let Math = global.Math;
const min = Math.min;
const Math2 = global.Math;
const value = 0;
const value3 = Reflect.apply(min, Math, [Math2.max(a1 - lastTimestamp, value), 64]);
Math = global.Math;
let abs = Math.abs;
let clamp = a2.clamp;
const value4 = Reflect.apply(abs, Math, [current - clamp[value]]);
Math = global.Math;
abs = Math.abs;
clamp = a2.clamp;
const value5 = 1;
const r7 = value4 < Reflect.apply(abs, Math, [current - clamp[value5]]) ? value : value5;
const r13 = current < a2.clamp[value] || current > a2.clamp[value5] ? current - a2.clamp[r7] : value;
Math = global.Math;
const exp = Math.exp;
const value11 = -(value5 - a2.deceleration) * (a1 - startTimestamp);
const SLOPE_FACTOR = require(dependencyMap[value]).SLOPE_FACTOR;
const value14 = velocity * Reflect.apply(exp, Math, [value11 * SLOPE_FACTOR]) - r13 * a2.rubberBandFactor;
Math = global.Math;
if (Math.abs(r13) > 0.1) {
a0.springActive = true;
a0.current = current + value14 * a2.velocityFactor * value3 / 1000;
a0.velocity = value14;
} else {
if (a0.springActive) {
a0.current = a2.clamp[r7];
return true;
}
var value16 = global.Math.abs(value14);
var VELOCITY_EPS = require(dependencyMap[value]).VELOCITY_EPS;
if (value16 < VELOCITY_EPS) {
return true;
}
a0.current = current + value14 * a2.velocityFactor * value3 / 1000;
a0.velocity = value14;
}
a0.lastTimestamp = a1;
return false;
}
}
}
global.__d(_fun18419, 1687, [1686]) /* metro module 1687, dependencies: [1686] */;