framer-motion-best-practices by pproenca/dot-skills
npx skills add https://github.com/pproenca/dot-skills --skill framer-motion-best-practicesReact 应用程序中 Framer Motion 动画的全面性能优化指南。包含 9 个类别共 42 条规则,按影响优先级排序,以指导自动化重构和代码生成。
在以下情况下参考这些指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 打包优化 | 关键 | bundle- |
| 2 | 防止重新渲染 | 关键 | rerender- |
| 3 | 动画属性 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
anim-| 4 | 布局动画 | 高 | layout- |
| 5 | 滚动动画 | 中高 | scroll- |
| 6 | 手势优化 | 中 | gesture- |
| 7 | 弹簧与物理 | 中 | spring- |
| 8 | SVG 与路径动画 | 低中 | svg- |
| 9 | 退出动画 | 低 | exit- |
bundle-lazy-motion - 使用 LazyMotion 和 m 组件代替 motionbundle-dynamic-features - 动态导入 motion 功能bundle-dom-animation - 对基础动画使用 domAnimationbundle-use-animate-mini - 对简单情况使用 mini useAnimatebundle-strict-mode - 启用严格模式以捕获意外导入rerender-motion-value - 使用 useMotionValue 代替 useStatererender-use-transform - 使用 useTransform 派生值rerender-stable-callbacks - 保持动画回调稳定rerender-variants-object - 在组件外部定义变体rerender-animate-prop - 使用稳定的 animate 值rerender-motion-value-event - 使用 motion value 事件anim-transform-properties - 动画化 transform 属性anim-opacity-filter - 对视觉效果优先使用 opacity 和 filteranim-hardware-acceleration - 利用硬件加速anim-will-change - 审慎使用 willChange 属性anim-independent-transforms - 独立动画化变换anim-keyframes-array - 对序列使用关键帧数组layout-dependency - 使用 layoutDependency 限制测量layout-position-size - 适当使用 layout="position" 或 "size"layout-group - 对相关布局动画进行分组layout-id-shared - 对共享元素过渡使用 layoutIdlayout-scroll - 为可滚动的祖先元素添加 layoutScrollscroll-use-scroll - 对滚动关联动画使用 useScroll 钩子scroll-use-spring-smooth - 使用 useSpring 实现平滑滚动动画scroll-element-tracking - 跟踪进入视口的特定元素scroll-offset-configuration - 配置滚动偏移量scroll-container-ref - 在特定容器内跟踪滚动gesture-while-props - 使用 whileHover/whileTap 代替处理程序gesture-variants-flow - 让手势变体流向子元素gesture-drag-constraints - 使用 dragConstraints ref 设置边界gesture-drag-elastic - 配置 dragElastic 以获得自然感觉gesture-tap-cancel - 对中断的手势使用 onTapCancelspring-physics-based - 对可中断性使用基于物理的弹簧spring-damping-ratio - 配置阻尼以控制振荡spring-mass-inertia - 调整质量以获得更重/更轻的感觉spring-use-spring-hook - 对响应式值使用 useSpringsvg-path-length - 对线条绘制动画使用 pathLengthsvg-motion-components - 使用 motion.path 和 motion.circlesvg-viewbox-animation - 动画化 viewBox 以实现缩放效果svg-morph-matching-points - 为变形动画匹配点数量exit-animate-presence - 用 AnimatePresence 包裹条件渲染exit-unique-keys - 为 AnimatePresence 子元素提供唯一键exit-mode-wait - 对顺序过渡使用 mode="wait"阅读单独的参考文件以获取详细说明和代码示例:
| 文件 | 描述 |
|---|---|
| references/_sections.md | 类别定义和排序 |
| assets/templates/_template.md | 新规则模板 |
| metadata.json | 版本和参考信息 |
每周安装量
187
仓库
GitHub 星标数
85
首次出现
2026年1月29日
安全审计
安装于
opencode150
gemini-cli147
codex143
claude-code137
github-copilot120
antigravity111
Comprehensive performance optimization guide for Framer Motion animations in React applications. Contains 42 rules across 9 categories, prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Bundle Optimization | CRITICAL | bundle- |
| 2 | Re-render Prevention | CRITICAL | rerender- |
| 3 | Animation Properties | HIGH | anim- |
| 4 | Layout Animations | HIGH | layout- |
| 5 | Scroll Animations | MEDIUM-HIGH | scroll- |
| 6 | Gesture Optimization | MEDIUM | gesture- |
| 7 | Spring & Physics | MEDIUM | spring- |
| 8 | SVG & Path Animations | LOW-MEDIUM | svg- |
| 9 | Exit Animations | LOW | exit- |
bundle-lazy-motion - Use LazyMotion and m component instead of motionbundle-dynamic-features - Dynamically import motion featuresbundle-dom-animation - Use domAnimation for basic animationsbundle-use-animate-mini - Use mini useAnimate for simple casesbundle-strict-mode - Enable strict mode to catch accidental importsrerender-motion-value - Use useMotionValue instead of useStatererender-use-transform - Derive values with useTransformrerender-stable-callbacks - Keep animation callbacks stablererender-variants-object - Define variants outside componentrerender-animate-prop - Use stable animate valuesanim-transform-properties - Animate transform propertiesanim-opacity-filter - Prefer opacity and filter for visual effectsanim-hardware-acceleration - Leverage hardware accelerationanim-will-change - Use willChange prop judiciouslyanim-independent-transforms - Animate transforms independentlylayout-dependency - Use layoutDependency to limit measurementslayout-position-size - Use layout="position" or "size" appropriatelylayout-group - Group related layout animationslayout-id-shared - Use layoutId for shared element transitionslayout-scroll - Add layoutScroll to scrollable ancestorsscroll-use-scroll - Use useScroll hook for scroll-linked animationsscroll-use-spring-smooth - Smooth scroll animations with useSpringscroll-element-tracking - Track specific elements entering viewportscroll-offset-configuration - Configure scroll offsetsscroll-container-ref - Track scroll within specific containersgesture-while-props - Use whileHover/whileTap instead of handlersgesture-variants-flow - Let gesture variants flow to childrengesture-drag-constraints - Use dragConstraints ref for boundariesgesture-drag-elastic - Configure dragElastic for natural feelgesture-tap-cancel - Use onTapCancel for interrupted gesturesspring-physics-based - Use physics-based springs for interruptibilityspring-damping-ratio - Configure damping to control oscillationspring-mass-inertia - Adjust mass for heavier/lighter feelspring-use-spring-hook - Use useSpring for reactive valuessvg-path-length - Use pathLength for line drawing animationssvg-motion-components - Use motion.path and motion.circlesvg-viewbox-animation - Animate viewBox for zoom effectssvg-morph-matching-points - Match point counts for morphingexit-animate-presence - Wrap conditional renders with AnimatePresenceexit-unique-keys - Provide unique keys for AnimatePresence childrenexit-mode-wait - Use mode="wait" for sequential transitionsRead individual reference files for detailed explanations and code examples:
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
Weekly Installs
187
Repository
GitHub Stars
85
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode150
gemini-cli147
codex143
claude-code137
github-copilot120
antigravity111
Genkit JS 开发指南:AI 应用构建、错误排查与最佳实践
6,100 周安装
应用商店截图优化指南:提升转化率的心理学与设计策略
543 周安装
Rust CLI开发指南:领域约束、clap参数解析与最佳实践
545 周安装
pua-ja AI助手:日本职场“詰め”文化驱动的主动式问题解决与任务执行方法论
559 周安装
Sherpa-onnx-tts 离线文本转语音工具 | 本地TTS CLI | 开源语音合成
577 周安装
OpenClaw voice-call 插件:集成 Twilio/Telnyx/Plivo 实现智能语音通话
593 周安装
iOS PermissionKit 教程:Swift 26+ 通信安全与家长权限请求框架
571 周安装
rerender-motion-value-eventanim-keyframes-array