UNPKG

hongluan-ui

Version:
55 lines (52 loc) 1.63 kB
import { isClient } from '@vueuse/core'; const cubic = (value) => { return value ** 3; }; const easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2; const setTransform = (transform, mark, newVal) => { const transformStr = transform == null ? void 0 : transform.replace(/,\s+/g, ","); if (!transform) { return newVal; } else { const items = transformStr.split(" "); const idx = items.findIndex((item) => item.indexOf(mark) > -1); if (idx > -1) { items[idx] = newVal; } else { items.push(newVal); } return items.join(" ").trim(); } }; const transitionEndName = function() { if (!isClient) return; const body = document.body || document.documentElement, style = body.style; const transEndEventNames = { transition: "transitionend", WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend" }; for (const name in transEndEventNames) { if (typeof style[name] === "string") { return transEndEventNames[name]; } } }(); const animationEndName = function() { if (!isClient) return; const body = document.body || document.documentElement, style = body.style; const animEndEventNames = { animation: "animationend", WebkitAnimation: "webkitAnimationEnd" }; for (const name in animEndEventNames) { if (typeof style[name] === "string") { return animEndEventNames[name]; } } }(); export { animationEndName, cubic, easeInOutCubic, setTransform, transitionEndName }; //# sourceMappingURL=animation.mjs.map