Aug 8, 2024
yarn add framer-motion
or npm install framer-motion
.motion
from Framer Motion.motion.div
for animations.initial
and animate
to define starting and ending states of animations.exit
prop to define how components animate out when unmounted.AnimatePresence
for exit animations to work.whileHover
to define animations on hover, e.g., scale up the button.whileTap
to define animations on click, e.g., scale down and rotate the button.motion.config
to define transitions for multiple components at once.useAnimation
hook and passing controls to the animate
prop.useInView
for detecting if an element is in view.useScroll
to track scroll progress and animate elements based on scroll position.useTransform
for mapping scroll values to colors or other properties.