From 67b57eae78c898a39dafd69e8d03ae45d7ed1dc2 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Fri, 5 Jun 2026 09:37:49 +0530 Subject: [PATCH] feat(renderer): add motion preset transitions for modals/sidebar/toasts --- src/renderer/lib/motion.ts | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/renderer/lib/motion.ts diff --git a/src/renderer/lib/motion.ts b/src/renderer/lib/motion.ts new file mode 100644 index 0000000..162a59f --- /dev/null +++ b/src/renderer/lib/motion.ts @@ -0,0 +1,41 @@ +import type { Transition, Variants } from 'motion/react'; + +export const fadeIn: Transition = { + duration: 0.2, + ease: 'easeOut', +}; + +export const slideInRight: Variants = { + x: '100%', + initial: { x: '100%', opacity: 0 }, + animate: { x: 0, opacity: 1, transition: { duration: 0.3, ease: [0.16, 1, 0.3, 1] } }, + exit: { x: '100%', opacity: 0, transition: { duration: 0.2, ease: 'easeIn' } }, +}; + +export const modalPop: Variants = { + scale: 0.96, + opacity: 0, + initial: { scale: 0.96, opacity: 0 }, + animate: { scale: 1, opacity: 1, transition: { duration: 0.2, ease: 'easeOut' } }, + exit: { scale: 0.96, opacity: 0, transition: { duration: 0.15, ease: 'easeIn' } }, +}; + +export const toastSpring: Transition = { + type: 'spring', + stiffness: 300, + damping: 30, +}; + +export const sidebarToggle: Transition = { + duration: 0.25, + ease: 'easeInOut', + width: { + duration: 0.25, + ease: 'easeInOut', + }, +}; + +export const tabSwitch: Transition = { + duration: 0.2, + ease: 'easeOut', +};