aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
117 lines (114 loc) • 3.17 kB
JavaScript
'use client';
import 'react/jsx-runtime';
import 'framer-motion';
import 'clsx';
import 'tailwind-merge';
/**
* Advanced Animation Easing Functions
* Provides sophisticated easing curves for glassmorphism transitions
*/
// Cubic bezier easing functions for advanced animations
const easings = {
// Exponential easing functions
easeOutExpo: t => {
return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
},
easeInExpo: t => {
return t === 0 ? 0 : Math.pow(2, 10 * (t - 1));
},
easeInOutExpo: t => {
if (t === 0) return 0;
if (t === 1) return 1;
if (t < 0.5) return Math.pow(2, 20 * t - 10) / 2;
return (2 - Math.pow(2, -20 * t + 10)) / 2;
},
// Back easing functions
easeOutBack: t => {
const c1 = 1.70158;
const c3 = c1 + 1;
return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
},
easeInBack: t => {
const c1 = 1.70158;
const c3 = c1 + 1;
return c3 * t * t * t - c1 * t * t;
},
easeInOutBack: t => {
const c1 = 1.70158;
const c2 = c1 * 1.525;
if (t < 0.5) {
return Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2) / 2;
} else {
return (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
}
},
// Cubic easing functions
easeInCubic: t => {
return t * t * t;
},
easeOutCubic: t => {
return 1 - Math.pow(1 - t, 3);
},
easeInOutCubic: t => {
if (t < 0.5) {
return 4 * t * t * t;
} else {
return 1 - Math.pow(-2 * t + 2, 3) / 2;
}
},
// Elastic easing functions
easeOutElastic: t => {
const c4 = 2 * Math.PI / 3;
if (t === 0) return 0;
if (t === 1) return 1;
return Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
},
easeInElastic: t => {
const c4 = 2 * Math.PI / 3;
if (t === 0) return 0;
if (t === 1) return 1;
return -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
},
// Bounce easing
easeOutBounce: t => {
const n1 = 7.5625;
const d1 = 2.75;
if (t < 1 / d1) {
return n1 * t * t;
} else if (t < 2 / d1) {
return n1 * (t -= 1.5 / d1) * t + 0.75;
} else if (t < 2.5 / d1) {
return n1 * (t -= 2.25 / d1) * t + 0.9375;
} else {
return n1 * (t -= 2.625 / d1) * t + 0.984375;
}
},
// Smooth step functions
smoothStep: t => {
return t * t * (3 - 2 * t);
},
smootherStep: t => {
return t * t * t * (t * (6 * t - 15) + 10);
},
// Glass-specific easing for material physics
glassEase: t => {
// Custom easing that mimics glass material behavior
// Starts slow, accelerates, then gently settles
if (t < 0.3) {
return t * t * 3.333; // Ease in
} else if (t < 0.7) {
return 0.3 + (t - 0.3) * 1.428; // Linear acceleration
} else {
return 0.7 + (t - 0.7) * (t - 0.7) * 3.333; // Ease out
}
},
// Shatter easing for glass break effects
shatterEase: t => {
// Exponential decay with bounce for shattering glass
const decay = Math.pow(1 - t, 2);
const bounce = Math.sin(t * Math.PI * 4) * Math.pow(1 - t, 0.5) * 0.1;
return decay + bounce;
}
};
export { easings };
//# sourceMappingURL=AdvancedAnimations.js.map