decord/source/1651_getEasingFromConfig.js

307 lines
12 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1651
2026-07-25 08:10:48 +00:00
// Function ID: 18356
2026-07-20 16:05:17 +00:00
// Name: getEasingFromConfig
2026-07-23 10:11:24 +00:00
// Dependencies: [1641, 1634, 1586, 1623, 1607, 1638, 1652, 1668, 1592, 1669, 1670, 1675]
2026-07-20 16:05:17 +00:00
// Module 1651 (getEasingFromConfig)
2026-07-23 10:11:24 +00:00
const require = arg1;
let dependencyMap = arg6;
2026-07-20 16:05:17 +00:00
function getEasingFromConfig(easingV) {
if (easingV.easingV) {
2026-07-23 10:11:24 +00:00
const tmp5 = easingV.easingV[require(undefined, 1634) /* linear */.EasingNameSymbol];
const obj2 = require(1641) /* getEasingByName */;
2026-07-20 16:05:17 +00:00
if (tmp6) {
return obj2.getEasingByName(tmp5);
} else {
let maybeGetBezierEasingResult = obj2.maybeGetBezierEasing(easingV.easingV);
if (!maybeGetBezierEasingResult) {
2026-07-23 10:11:24 +00:00
const logger = require(1586) /* noop */.logger;
2026-07-20 16:05:17 +00:00
logger.warn("Selected easing is not currently supported on web. Using linear easing instead.");
2026-07-23 10:11:24 +00:00
maybeGetBezierEasingResult = require(1641) /* getEasingByName */.getEasingByName("linear");
const obj3 = require(1641) /* getEasingByName */;
2026-07-20 16:05:17 +00:00
}
return maybeGetBezierEasingResult;
}
2026-07-23 10:11:24 +00:00
tmp6 = tmp5 in require(1641) /* getEasingByName */.WebEasings;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
return require(1641) /* getEasingByName */.getEasingByName("linear");
2026-07-20 16:05:17 +00:00
}
}
function getRandomDelay(delayV) {
let num = 1000;
if (arguments.length > 0) {
num = 1000;
if (undefined !== arguments[0]) {
num = arguments[0];
}
}
return Math.floor(Math.random() * (num + 1)) / 1000;
}
function getDelayFromConfig(randomizeDelay) {
randomizeDelay = randomizeDelay.randomizeDelay;
let num = 0;
if (randomizeDelay) {
num = getRandomDelay();
}
if (!randomizeDelay.delayV) {
return num;
} else if (randomizeDelay) {
let result = getRandomDelay(tmp.delayV);
} else {
result = tmp.delayV / 1000;
}
}
function getDurationFromConfig(durationV, animationWithInitialValues) {
let num = 0.3;
2026-07-23 10:11:24 +00:00
if (animationWithInitialValues in require(1638) /* TransitionType */.Animations) {
num = require(1638) /* TransitionType */.Animations[animationWithInitialValues].duration;
2026-07-20 16:05:17 +00:00
}
if (undefined !== durationV.durationV) {
num = durationV.durationV / 1000;
}
return num;
}
function getCallbackFromConfig(callbackV) {
callbackV = null;
if (undefined !== callbackV.callbackV) {
callbackV = callbackV.callbackV;
}
return callbackV;
}
function getReversedFromConfig(reversed) {
return reversed.reversed;
}
function saveSnapshot(_componentDOMRef) {
const size = _componentDOMRef.getBoundingClientRect();
2026-07-23 10:11:24 +00:00
const snapshots = require(1668) /* weakMap */.snapshots;
2026-07-20 16:05:17 +00:00
const result = snapshots.set(_componentDOMRef, { top: size.top, left: size.left, width: size.width, height: size.height, scrollOffsets: getElementScrollValue(_componentDOMRef) });
}
function setElementAnimation(cloneNodeResult, dummyAnimationConfig, arg2, offsetParent) {
2026-07-23 10:11:24 +00:00
const _require = cloneNodeResult;
const dependencyMap = dummyAnimationConfig;
2026-07-20 16:05:17 +00:00
let closure_2 = arguments.length > 2 && undefined !== arguments[2] && arguments[2];
let tmp = null;
if (arguments.length > 3) {
tmp = null;
if (undefined !== arguments[3]) {
tmp = arguments[3];
}
}
const getRandomDelay = tmp;
const animationName = dummyAnimationConfig.animationName;
const duration = dummyAnimationConfig.duration;
const delay = dummyAnimationConfig.delay;
2026-07-23 10:11:24 +00:00
const easing = dummyAnimationConfig.easing;
2026-07-20 16:05:17 +00:00
function configureAnimation() {
2026-07-23 10:11:24 +00:00
cloneNodeResult.style.animationName = animationName;
cloneNodeResult.style.animationDuration = "" + duration + "s";
cloneNodeResult.style.animationDelay = "" + delay + "s";
cloneNodeResult.style.animationTimingFunction = easing;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (dummyAnimationConfig.animationType === _require(1607).LayoutAnimationType.ENTERING) {
2026-07-20 16:05:17 +00:00
const _requestAnimationFrame = requestAnimationFrame;
const animationFrame = requestAnimationFrame(configureAnimation);
} else {
configureAnimation();
}
2026-07-23 10:11:24 +00:00
function maybeRemoveElement(closure_0) {
let isDummy = cloneNodeResult.isDummy;
2026-07-20 16:05:17 +00:00
if (isDummy) {
isDummy = null != tmp;
}
if (isDummy) {
2026-07-23 10:11:24 +00:00
isDummy = tmp.contains(cloneNodeResult);
2026-07-20 16:05:17 +00:00
}
if (isDummy) {
2026-07-23 10:11:24 +00:00
cloneNodeResult.removedAfterAnimation = true;
tmp.removeChild(cloneNodeResult);
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let c9 = false;
2026-07-20 16:05:17 +00:00
function maybeCallCallback(arg0) {
2026-07-23 10:11:24 +00:00
let callback = !c9;
if (!c9) {
callback = dummyAnimationConfig.callback;
2026-07-20 16:05:17 +00:00
}
if (callback) {
2026-07-23 10:11:24 +00:00
dummyAnimationConfig.callback(arg0);
c9 = true;
2026-07-20 16:05:17 +00:00
}
}
cloneNodeResult.onanimationend = () => {
if (closure_2) {
2026-07-23 10:11:24 +00:00
maybeRemoveElement(cloneNodeResult);
2026-07-20 16:05:17 +00:00
}
maybeRemoveElement();
maybeCallCallback(true);
2026-07-23 10:11:24 +00:00
const removed = cloneNodeResult.removeEventListener("animationcancel", animationCancelHandler);
2026-07-20 16:05:17 +00:00
};
function animationCancelHandler() {
maybeRemoveElement();
maybeCallCallback(false);
2026-07-23 10:11:24 +00:00
const removed = cloneNodeResult.removeEventListener("animationcancel", animationCancelHandler);
2026-07-20 16:05:17 +00:00
}
cloneNodeResult.onanimationstart = () => {
2026-07-23 10:11:24 +00:00
if (dummyAnimationConfig.animationType === cloneNodeResult(dummyAnimationConfig[4]).LayoutAnimationType.ENTERING) {
let obj = cloneNodeResult(dummyAnimationConfig[8]);
2026-07-20 16:05:17 +00:00
obj = { visibility: "initial" };
2026-07-23 10:11:24 +00:00
obj._updatePropsJS(obj, cloneNodeResult);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const listener = cloneNodeResult.addEventListener("animationcancel", animationCancelHandler);
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
if (!(animationName in _require(1638).Animations)) {
const result = _require(1669).scheduleAnimationCleanup(animationName, duration + delay, () => {
2026-07-20 16:05:17 +00:00
if (closure_2) {
2026-07-23 10:11:24 +00:00
const snapshots = cloneNodeResult(dummyAnimationConfig[7]).snapshots;
cloneNodeResult(dummyAnimationConfig[7]).setElementPosition(cloneNodeResult, snapshots.get(cloneNodeResult));
const obj = cloneNodeResult(dummyAnimationConfig[7]);
2026-07-20 16:05:17 +00:00
}
maybeRemoveElement();
maybeCallCallback(false);
});
2026-07-23 10:11:24 +00:00
let obj = _require(1669);
2026-07-20 16:05:17 +00:00
}
}
function getElementScrollValue(offsetParent) {
let parentElement = offsetParent;
2026-07-23 10:11:24 +00:00
const obj = { scrollTopOffset: 0, scrollLeftOffset: 0 };
2026-07-20 16:05:17 +00:00
if (offsetParent) {
do {
let tmp = 0 !== parentElement.scrollTop && 0 === obj.scrollTopOffset;
if (tmp) {
obj.scrollTopOffset = parentElement.scrollTop;
}
let tmp2 = 0 !== parentElement.scrollLeft && 0 === obj.scrollLeftOffset;
if (tmp2) {
obj.scrollLeftOffset = parentElement.scrollLeft;
}
parentElement = parentElement.parentElement;
} while (parentElement);
}
return obj;
}
arg5.getReducedMotionFromConfig = function getReducedMotionFromConfig(entering) {
if (entering.reduceMotionV) {
const reduceMotionV = entering.reduceMotionV;
2026-07-23 10:11:24 +00:00
if (require(1607) /* isWorkletFunction */.ReduceMotion.Never === reduceMotionV) {
2026-07-20 16:05:17 +00:00
return false;
2026-07-23 10:11:24 +00:00
} else if (require(1607) /* isWorkletFunction */.ReduceMotion.Always === reduceMotionV) {
2026-07-20 16:05:17 +00:00
return true;
} else {
2026-07-23 10:11:24 +00:00
return require(1623) /* isReducedMotionEnabledInSystem */.ReducedMotionManager.jsValue;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-23 10:11:24 +00:00
return require(1623) /* isReducedMotionEnabledInSystem */.ReducedMotionManager.jsValue;
2026-07-20 16:05:17 +00:00
}
};
arg5.getProcessedConfig = function getProcessedConfig(animationWithInitialValues, animationType, entering) {
return { animationName: animationWithInitialValues, animationType, duration: getDurationFromConfig(entering, animationWithInitialValues), delay: getDelayFromConfig(entering), easing: getEasingFromConfig(entering), callback: getCallbackFromConfig(entering), reversed: getReversedFromConfig(entering) };
};
arg5.maybeModifyStyleForKeyframe = function maybeModifyStyleForKeyframe(style, entering) {
2026-07-23 10:11:24 +00:00
if (entering instanceof require(1652) /* BaseAnimationBuilder */.Keyframe) {
2026-07-20 16:05:17 +00:00
style.style.animationFillMode = "forwards";
const _Object = Object;
const values = Object.values(entering.definitions);
const iter = values[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
if (!("originX" in nextResult)) {
let tmp8 = nextResult;
}
let str4 = "absolute";
style.style.position = "absolute";
iter.return();
}
}
};
arg5.saveSnapshot = saveSnapshot;
arg5.setElementAnimation = setElementAnimation;
arg5.handleLayoutTransition = function handleLayoutTransition(_componentDOMRef, animationName, easingY) {
let dummyTransitionKeyframeName;
animationName = animationName.animationName;
if ("LinearTransition" === animationName) {
2026-07-23 10:11:24 +00:00
let ENTRY_EXIT = require(1638) /* TransitionType */.TransitionType.LINEAR;
2026-07-20 16:05:17 +00:00
} else if ("SequencedTransition" === animationName) {
2026-07-23 10:11:24 +00:00
ENTRY_EXIT = require(1638) /* TransitionType */.TransitionType.SEQUENCED;
2026-07-20 16:05:17 +00:00
} else if ("FadingTransition" === animationName) {
2026-07-23 10:11:24 +00:00
ENTRY_EXIT = require(1638) /* TransitionType */.TransitionType.FADING;
2026-07-20 16:05:17 +00:00
} else if ("JumpingTransition" === animationName) {
2026-07-23 10:11:24 +00:00
ENTRY_EXIT = require(1638) /* TransitionType */.TransitionType.JUMPING;
2026-07-20 16:05:17 +00:00
} else if ("CurvedTransition" === animationName) {
2026-07-23 10:11:24 +00:00
ENTRY_EXIT = require(1638) /* TransitionType */.TransitionType.CURVED;
2026-07-20 16:05:17 +00:00
} else if ("EntryExitTransition" === animationName) {
2026-07-23 10:11:24 +00:00
ENTRY_EXIT = require(1638) /* TransitionType */.TransitionType.ENTRY_EXIT;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const obj = require(1670) /* addPxToTransform */;
({ dummyTransitionKeyframeName, transitionKeyframeName: animationName.animationName } = require(1670) /* addPxToTransform */.TransitionGenerator(ENTRY_EXIT, easingY));
if (ENTRY_EXIT === require(1638) /* TransitionType */.TransitionType.CURVED) {
const obj2 = require(1675) /* showChildren */;
2026-07-20 16:05:17 +00:00
const result = obj2.prepareCurvedTransition(_componentDOMRef, animationName, easingY, dummyTransitionKeyframeName);
setElementAnimation(result.dummy, result.dummyAnimationConfig);
}
setElementAnimation(_componentDOMRef, animationName);
};
arg5.handleExitingAnimation = function handleExitingAnimation(offsetParent, dummyAnimationConfig) {
let firstChild;
2026-07-23 10:11:24 +00:00
const _require = offsetParent;
2026-07-20 16:05:17 +00:00
offsetParent = offsetParent.offsetParent;
const cloneNodeResult = offsetParent.cloneNode();
2026-07-23 10:11:24 +00:00
const dependencyMap = cloneNodeResult;
2026-07-20 16:05:17 +00:00
cloneNodeResult.isDummy = true;
cloneNodeResult.style.animationName = "";
offsetParent.dummyClone = cloneNodeResult;
offsetParent.style.animationName = "";
2026-07-23 10:11:24 +00:00
const map = new Map();
function saveScrollPosition(item10015) {
const result = map.set(item10015, { top: item10015.scrollTop, left: item10015.scrollLeft });
2026-07-20 16:05:17 +00:00
for (const item10015 of arr) {
2026-07-23 10:11:24 +00:00
let tmp3 = saveScrollPosition;
let tmp4 = saveScrollPosition(item10015);
continue;
2026-07-20 16:05:17 +00:00
}
}
saveScrollPosition(offsetParent);
if (offsetParent.firstChild) {
do {
let appendChildResult = cloneNodeResult.appendChild(offsetParent.firstChild);
firstChild = offsetParent.firstChild;
} while (firstChild);
}
if (null != offsetParent) {
offsetParent.appendChild(cloneNodeResult);
}
function restoreScrollPosition(cloneNodeResult) {
let tmp2 = cloneNodeResult;
2026-07-23 10:11:24 +00:00
if (cloneNodeResult === closure_1) {
tmp2 = closure_0;
2026-07-20 16:05:17 +00:00
}
const value = map.get(tmp2);
if (value) {
({ top: cloneNodeResult.scrollTop, left: cloneNodeResult.scrollLeft } = value);
}
for (const item10016 of arr) {
2026-07-23 10:11:24 +00:00
let tmp5 = restoreScrollPosition;
let tmp6 = restoreScrollPosition(item10016);
continue;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let result = restoreScrollPosition(cloneNodeResult);
const snapshots = _require(1668).snapshots;
2026-07-20 16:05:17 +00:00
const rect = snapshots.get(offsetParent);
2026-07-23 10:11:24 +00:00
let tmp6 = getElementScrollValue(offsetParent);
2026-07-20 16:05:17 +00:00
const scrollTopOffset = tmp6.scrollTopOffset;
const scrollTopOffset2 = rect.scrollOffsets.scrollTopOffset;
if (scrollTopOffset !== scrollTopOffset2) {
rect.top = rect.top + (scrollTopOffset2 - scrollTopOffset);
}
const scrollLeftOffset = tmp6.scrollLeftOffset;
const scrollLeftOffset2 = rect.scrollOffsets.scrollLeftOffset;
if (scrollLeftOffset !== scrollLeftOffset2) {
rect.left = rect.left + (scrollLeftOffset2 - scrollLeftOffset);
}
2026-07-23 10:11:24 +00:00
const snapshots2 = _require(1668).snapshots;
2026-07-20 16:05:17 +00:00
const result1 = snapshots2.set(cloneNodeResult, rect);
2026-07-23 10:11:24 +00:00
_require(1668).setElementPosition(cloneNodeResult, rect);
2026-07-20 16:05:17 +00:00
setElementAnimation(cloneNodeResult, dummyAnimationConfig, false, offsetParent);
};