first commit
This commit is contained in:
13
node_modules/motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs
generated
vendored
Normal file
13
node_modules/motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { memo } from 'motion-utils';
|
||||
|
||||
const supportsPartialKeyframes = /*@__PURE__*/ memo(() => {
|
||||
try {
|
||||
document.createElement("div").animate({ opacity: [1] });
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
export { supportsPartialKeyframes };
|
||||
43
node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs
generated
vendored
Normal file
43
node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { memo } from 'motion-utils';
|
||||
|
||||
/**
|
||||
* A list of values that can be hardware-accelerated.
|
||||
*/
|
||||
const acceleratedValues = new Set([
|
||||
"opacity",
|
||||
"clipPath",
|
||||
"filter",
|
||||
"transform",
|
||||
// TODO: Could be re-enabled now we have support for linear() easing
|
||||
// "background-color"
|
||||
]);
|
||||
const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
||||
function supportsBrowserAnimation(options) {
|
||||
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
||||
const subject = motionValue?.owner?.current;
|
||||
/**
|
||||
* We use this check instead of isHTMLElement() because we explicitly
|
||||
* **don't** want elements in different timing contexts (i.e. popups)
|
||||
* to be accelerated, as it's not possible to sync these animations
|
||||
* properly with those driven from the main window frameloop.
|
||||
*/
|
||||
if (!(subject instanceof HTMLElement)) {
|
||||
return false;
|
||||
}
|
||||
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
||||
return (supportsWaapi() &&
|
||||
name &&
|
||||
acceleratedValues.has(name) &&
|
||||
(name !== "transform" || !transformTemplate) &&
|
||||
/**
|
||||
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
||||
* no way to read the value from WAAPI every frame.
|
||||
*/
|
||||
!onUpdate &&
|
||||
!repeatDelay &&
|
||||
repeatType !== "mirror" &&
|
||||
damping !== 0 &&
|
||||
type !== "inertia");
|
||||
}
|
||||
|
||||
export { supportsBrowserAnimation };
|
||||
Reference in New Issue
Block a user