Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.
中文简介正在准备中。当前显示原文说明。
Animate React with Framer Motion (Motion): gestures, layout animations, variants, scroll-linked motion, and exit transitions. Use when adding production-grade UI animation.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
A practical guide to Framer Motion (now "Motion"): declarative React animations — gestures, layout animations, variants, scroll-linked motion, and AnimatePresence — with the performance habits that keep animations at 60fps.
Framer Motion (the framer-motion package, now evolving as "Motion") lets you animate React declaratively: <motion.div animate={{ x: 100 }} />. It handles the hard parts — interruptible animations, layout projection (animating between layouts), drag gestures with physics, and exit animations for unmounting components. The core principle: animate transforms and opacity (GPU-cheap); avoid animating layout properties (width, top, margin) which force reflow.
motion components. motion.div etc. accept initial, animate, exit, whileHover, whileTap, whileInView, whileFocus — declarative animation states.transition={{ type: 'spring', stiffness: 300, damping: 30 }} (physics, natural) vs type: 'tween', duration: 0.3, ease: 'easeOut' (precise). Springs for UI physics; tweens for choreographed sequences.animate="open" flows to children with matching variant labels — orchestrated multi-element animation from one prop.AnimatePresence. Wraps conditionally-rendered components to animate exit on unmount. mode="wait" / popLayout for transitions between components.layout prop animates position/size changes when layout shifts (list reorder, expand). layoutId creates shared-element transitions between different components ("magic motion").drag, dragConstraints, dragElastic, whileDrag; useMotionValue + useTransform for manual control (e.g., parallax from scroll).useScroll / useInView. Scroll progress as a motion value; in-view triggers for reveal animations.1. Micro-interaction.
<motion.button
whileHover={{ scale: 1.04 }}
whileTap={{ scale: 0.96 }}
transition={{ type: 'spring', stiffness: 400, damping: 25 }}
>
Save
</motion.button>
2. Enter/exit.
<AnimatePresence>
{open && (
<motion.div
initial={{ opacity: 0, y: 16, scale: 0.98 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 8, scale: 0.98 }}
transition={{ duration: 0.2, ease: 'easeOut' }}
>
{content}
</motion.div>
)}
</AnimatePresence>
3. Orchestrated list (variants).
const list = { show: { transition: { staggerChildren: 0.06 } } };
const item = { hidden: { opacity: 0, y: 12 }, show: { opacity: 1, y: 0 } };
<motion.ul variants={list} initial="hidden" animate="show">
{items.map(i => <motion.li key={i.id} variants={item}>{i.name}</motion.li>)}
</motion.ul>
4. Scroll-linked.
const { scrollYProgress } = useScroll();
const y = useTransform(scrollYProgress, [0, 1], [0, -80]);
<motion.div style={{ y }}>...</motion.div> // style motion values skip re-render
5. Shared element.
{selected ? <motion.div layoutId="card" .../> : <motion.div layoutId="card" .../>}
Same layoutId in two places → automatic morph transition.
width, height, top, left in animate → layout thrash. Use scale, x/y, opacity; use layout prop for genuine layout changes.AnimatePresence. Conditional render without it = instant unmount, no exit animation. Wrap every exiting element.key discipline. AnimatePresence children and layout animations need stable keys; key changes remount and restart animations.layoutId collisions. Two mounted components with the same layoutId = broken projection. Ensure uniqueness among mounted elements.prefers-reduced-motion: useReducedMotion() or MotionConfig reducedMotion="user" to disable non-essential animation.style={{ x: motionValue }} — Motion updates the DOM directly.mode="wait" — otherwise exits never play.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.
中文简介正在准备中。当前显示原文说明。
Create 3D visuals with modeling, texturing, lighting, rendering, and optimization for web and product.
中文简介正在准备中。当前显示原文说明。
Create 3D web experiences: scene setup, models, materials, lighting, animation, scroll-driven scenes, and performance budgets. Use when adding 3D to websites beyond basic demos.
中文简介正在准备中。当前显示原文说明。
Writing abstracts that get papers read — structured content, the 5-sentence core, and journal-specific constraints.
中文简介正在准备中。当前显示原文说明。
Learn effectively from courses and academies: choosing programs, studying actively, and converting courses into skills. Use when investing time/money in structured learning.
中文简介正在准备中。当前显示原文说明。
Audit designs for accessibility with WCAG checklists covering color, type, focus, motion, and content.
中文简介正在准备中。当前显示原文说明。