ConceptPortal-public/rsconcept/frontend/src/styling/animations.ts

309 lines
4.9 KiB
TypeScript
Raw Normal View History

/**
* Module: animations parameters.
*/
import { Variants } from 'framer-motion';
/**
* Duration constants in ms.
*/
export const animationDuration = {
navigationToggle: 500
};
export const animateNavigation: Variants = {
open: {
height: '3rem',
translateY: 0,
transition: {
type: 'spring',
bounce: 0,
duration: animationDuration.navigationToggle / 1000
}
},
closed: {
height: 0,
translateY: '-1.5rem',
transition: {
type: 'spring',
bounce: 0,
duration: animationDuration.navigationToggle / 1000
}
}
};
export const animateNavigationToggle: Variants = {
on: {
height: '3rem',
width: '1.2rem',
transition: {
type: 'spring',
bounce: 0,
duration: animationDuration.navigationToggle / 1000
}
},
off: {
height: '1.2rem',
width: '3rem',
transition: {
type: 'spring',
bounce: 0,
duration: animationDuration.navigationToggle / 1000
}
}
};
2024-02-22 15:07:05 +03:00
export const animateSlideLeft: Variants = {
open: {
clipPath: 'inset(0% 0% 0% 0%)',
transition: {
type: 'spring',
bounce: 0,
duration: 0.4,
delayChildren: 0.2,
staggerChildren: 0.05
}
},
closed: {
clipPath: 'inset(0% 100% 0% 0%)',
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
}
};
2024-04-07 19:22:19 +03:00
export const animateHiddenHeader: Variants = {
open: {
translateX: 'calc(6.5rem - 50%)',
marginLeft: 0,
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
},
closed: {
translateX: 0,
marginLeft: '0.75rem',
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
}
};
export const animateDropdown: Variants = {
open: {
clipPath: 'inset(0% 0% 0% 0%)',
transition: {
type: 'spring',
bounce: 0,
duration: 0.4,
delayChildren: 0.2,
staggerChildren: 0.05
}
},
closed: {
clipPath: 'inset(10% 0% 90% 0%)',
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
}
};
export const animateDropdownItem: Variants = {
open: {
opacity: 1,
y: 0,
transition: {
type: 'spring',
duration: 0.1,
stiffness: 300,
damping: 24
}
},
closed: {
opacity: 0,
y: 10,
transition: {
duration: 0.1
}
}
};
export const animateRSControl: Variants = {
open: {
clipPath: 'inset(0% 0% 0% 0%)',
2023-12-27 18:44:37 +03:00
marginTop: '0.25rem',
height: 'max-content',
transition: {
type: 'spring',
bounce: 0,
duration: 0.4
}
},
closed: {
clipPath: 'inset(0% 0% 100% 0%)',
2023-12-27 18:44:37 +03:00
marginTop: '0',
height: 0,
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
}
};
export const animateParseResults: Variants = {
open: {
clipPath: 'inset(0% 0% 0% 0%)',
marginTop: '0.75rem',
padding: '0.25rem 0.5rem 0.25rem 0.5rem',
borderWidth: '1px',
height: '4.5rem',
transition: {
type: 'spring',
bounce: 0,
duration: 0.4
}
},
closed: {
clipPath: 'inset(0% 0% 100% 0%)',
marginTop: '0',
borderWidth: '0',
padding: '0 0 0 0',
height: 0,
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
}
};
export const animateSideView = {
initial: {
2024-06-20 19:47:34 +03:00
width: 0,
opacity: 0
},
animate: {
2024-06-20 19:47:34 +03:00
width: 'auto',
opacity: 1,
transition: {
2024-06-20 19:47:34 +03:00
width: {
duration: 0.4
},
opacity: {
delay: 0.4,
duration: 0
}
}
},
exit: {
2024-06-20 19:47:34 +03:00
width: 0,
opacity: 0,
transition: {
2024-06-20 19:47:34 +03:00
width: {
duration: 0.4
},
opacity: {
duration: 0
}
}
}
};
2024-05-15 02:51:50 +03:00
export const animateSideAppear = {
initial: {
2024-05-20 17:45:37 +03:00
height: 0,
opacity: 0
2024-05-15 02:51:50 +03:00
},
animate: {
2024-05-20 17:45:37 +03:00
height: 'auto',
opacity: 1,
2024-05-15 02:51:50 +03:00
transition: {
2024-05-20 17:45:37 +03:00
height: {
duration: 0.25
},
opacity: {
delay: 0.25,
duration: 0
}
2024-05-15 02:51:50 +03:00
}
},
exit: {
2024-05-20 17:45:37 +03:00
height: 0,
opacity: 0,
2024-05-15 02:51:50 +03:00
transition: {
2024-05-20 17:45:37 +03:00
height: {
duration: 0.25
},
opacity: {
duration: 0
}
2024-05-15 02:51:50 +03:00
}
}
};
export const animateModal = {
initial: {
clipPath: 'inset(50% 50% 50% 50%)',
opacity: 0
},
animate: {
clipPath: 'inset(0% 0% 0% 0%)',
opacity: 1,
transition: {
type: 'spring',
bounce: 0,
duration: 0.3
}
},
exit: {
opacity: 0,
clipPath: 'inset(50% 50% 50% 50%)',
transition: {
type: 'spring',
bounce: 0,
duration: 0.2
}
}
2023-12-28 14:04:44 +03:00
};
2024-01-07 03:29:16 +03:00
export const animateFade = {
initial: {
opacity: 0
},
2024-04-01 11:13:50 +03:00
variants: {
active: {
opacity: 1,
transition: {
type: 'tween',
ease: 'linear',
duration: 0.4
2024-04-01 11:13:50 +03:00
}
},
hidden: {
opacity: 0,
transition: {
type: 'tween',
ease: 'linear',
duration: 0.4
2024-04-01 11:13:50 +03:00
}
}
},
exit: {
opacity: 0,
transition: {
type: 'tween',
ease: 'linear',
duration: 0.4
}
}
};