mcpField
F
framer-motion-best-practices

framer-motion-best-practices

github.com/pproenca设计与 UI218187 次安装11 周前更新
代码仓库

关于 framer-motion-best-practices

为 React 应用中的 Framer Motion 动画提供性能指导,适用于实现或重构动画的开发者。规则按优先级覆盖包体积、渲染、布局、滚动、手势和退出动画。

主要功能

  1. 01涵盖 9 类的 42 条规则
  2. 02按优先级组织动画指导
  3. 03优化包体积
  4. 04减少重复渲染
  5. 05布局与滚动动画模式
  6. 06手势、弹簧、SVG 和退出动画指导

适用场景

  1. 01优化动画密集型 React 应用的包体积
  2. 02减少动画期间的重复渲染
  3. 03实现布局或共享元素过渡
  4. 04构建滚动联动或手势交互

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/pproenca/dot-skills --skill framer-motion-best-practices

安装后在 Claude Code 中输入/framer-motion-best-practices确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

metadata.json
assets/templates/
_template.md
references/
_sections.md
anim-hardware-acceleration.md
anim-independent-transforms.md
anim-keyframes-array.md
anim-opacity-filter.md
anim-transform-properties.md
anim-will-change.md
bundle-dom-animation.md
bundle-dynamic-features.md
bundle-lazy-motion.md
bundle-strict-mode.md
bundle-use-animate-mini.md
exit-animate-presence.md
exit-mode-wait.md
exit-unique-keys.md
gesture-drag-constraints.md
gesture-drag-elastic.md
gesture-tap-cancel.md
gesture-variants-flow.md
gesture-while-props.md
layout-dependency.md
layout-group.md
layout-id-shared.md
layout-position-size.md
layout-scroll.md
rerender-animate-prop.md
rerender-motion-value-event.md
rerender-motion-value.md

详细介绍

Framer Motion 社区最佳实践

面向 React 应用中 Framer Motion 动画的全面性能优化指南。包含 9 个类别中的 42 条规则,按影响程度排序,帮助自动重构和代码生成。

适用场景

在以下情况下参考这些指南:

  • 使用 Framer Motion 为 React 组件添加动画
  • 优化动画密集型应用的包体积
  • 避免动画过程中不必要的重新渲染
  • 实现布局过渡或共享元素动画
  • 构建与滚动联动或基于手势的交互

按优先级划分的规则类别

优先级类别影响前缀
1包优化CRITICALbundle-
2防止重新渲染CRITICALrerender-
3动画属性HIGHanim-
4布局动画HIGHlayout-
5滚动动画MEDIUM-HIGHscroll-
6手势优化MEDIUMgesture-
7弹簧与物理效果MEDIUMspring-
8SVG 与路径动画LOW-MEDIUMsvg-
9退出动画LOWexit-

快速参考

1. 包优化(CRITICAL)
2. 防止重新渲染(CRITICAL)
3. 动画属性(HIGH)
4. 布局动画(HIGH)
5. 滚动动画(中高)
6. 手势优化(中)
7. 弹簧与物理效果(中)
8. SVG 与路径动画(低中)
9. 退出动画(低)

使用方法

阅读各个参考文件,了解详细说明和代码示例:

参考文件

文件描述
references/_sections.md类别定义和排序
assets/templates/_template.md新规则模板
metadata.json版本和参考信息

评论

支持 Markdown