first commit
This commit is contained in:
28
node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs
generated
vendored
Normal file
28
node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { isBezierDefinition } from 'motion-utils';
|
||||
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
||||
import { generateLinearEasing } from '../utils/linear.mjs';
|
||||
import { cubicBezierAsString } from './cubic-bezier.mjs';
|
||||
import { supportedWaapiEasing } from './supported.mjs';
|
||||
|
||||
function mapEasingToNativeEasing(easing, duration) {
|
||||
if (!easing) {
|
||||
return undefined;
|
||||
}
|
||||
else if (typeof easing === "function") {
|
||||
return supportsLinearEasing()
|
||||
? generateLinearEasing(easing, duration)
|
||||
: "ease-out";
|
||||
}
|
||||
else if (isBezierDefinition(easing)) {
|
||||
return cubicBezierAsString(easing);
|
||||
}
|
||||
else if (Array.isArray(easing)) {
|
||||
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) ||
|
||||
supportedWaapiEasing.easeOut);
|
||||
}
|
||||
else {
|
||||
return supportedWaapiEasing[easing];
|
||||
}
|
||||
}
|
||||
|
||||
export { mapEasingToNativeEasing };
|
||||
Reference in New Issue
Block a user