Browse Source

🔧 Refactor animation variants

🛠️ Improve code readability and maintainability
📦 Export variants function for reuse
🔍 Adjust default parameters for flexibility
🌟 Enhance animation logic
main
John Doe 1 year ago
parent
commit
186bee9ba6
  1. 18
      src/utils/animationVariants.ts

18
src/utils/animationVariants.ts

@ -0,0 +1,18 @@
export const variants = (x = 1000, opacity = 0) => ({
enter: (direction: number) => {
return {
x: direction > 0 ? x : -x,
opacity,
};
},
center: {
x: 0,
opacity: 1,
},
exit: (direction: number) => {
return {
x: direction < 0 ? x : -x,
opacity,
};
},
});
Loading…
Cancel
Save