Token导航 LogoToken导航TokenDH.com
开发规范操作浏览器github未标认证来源可访问许可证需确认审计通过

animation-best-practices动画最佳实践

Agent Skill

用于辅助视频生成、动画合成、脚本化剪辑或 Remotion 等视频项目开发。它适合让 Agent 组织镜头、生成素材说明、维护合成代码或排查渲染问题。使用时需要确认分辨率、时长、素材路径和导出格式;涉及外部素材、人物肖像或商业发布时,应先核对版权授权和内容审核要求。

总安装

2,568

周安装

107

GitHub Stars

6,278

下载量

856
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:animation-best-practices(动画最佳实践)
来源仓库:https://github.com/millionco/react-doctor
仓库路径:skills/animation-best-practices
安装命令:
npx skills add https://github.com/millionco/react-doctor --skill animation-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/millionco/react-doctor --skill animation-best-practices

简介

animation-best-practices 聚焦 CSS 与 Framer Motion 动画的实际开发技巧,强调性能优化与调试方法。

  • 适用于排查抖动动画、布局重排、GPU 切换异常等问题,提升界面动效稳定性。
  • 提供 will-change 提示、逐帧录制、断点休息等实用建议,平衡创作效率与健康工作习惯。
  • 建议配合浏览器开发者工具使用,实时观察层叠上下文变化与复合器线程负载情况。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Practical Animation Tips

Detailed reference guide for common animation scenarios. Use this as a checklist when implementing animations.

Recording & Debugging

Record Your Animations

When something feels off but you can't identify why, record the animation and play it back frame by frame. This reveals details invisible at normal speed.

Fix Shaky Animations

Elements may shift by 1px at the start/end of CSS transform animations due to GPU/CPU rendering handoff.

Fix:

.element {
  will-change: transform;
}

This tells the browser to keep the element on the GPU throughout the animation.

Take Breaks

Don't code and ship animations in one sitting. Step away, return with fresh eyes. The best animations are reviewed and refined over days, not hours.

Button & Click Feedback

Scale Buttons on Press

Make interfaces feel responsive by adding subtle scale feedback:

button:active {
  transform: scale(0.97);
}

This gives instant visual feedback that the interface is listening.

Don't Animate from scale(0)

Starting from scale(0) makes elements appear from nowhere—it feels unnatural.

Bad:

.element {
  transform: scale(0);
}
.element.visible {
  transform: scale(1);
}

Good:

.element {
  transform: scale(0.95);
  opacity: 0;
}
.element.visible {
  transform: scale(1);
  opacity: 1;
}

Elements should always have some visible shape, like a deflated balloon.

Tooltips & Popovers

Skip Animation on Subsequent Tooltips

First tooltip: delay + animation. Subsequent tooltips (while one is open): instant, no delay.

.tooltip {
  transition:
    transform 125ms ease-out,
    opacity 125ms ease-out;
  transform-origin: var(--transform-origin);
}

.tooltip[data-starting-style],
.tooltip[data-ending-style] {
  opacity: 0;
  transform: scale(0.97);
}

/* Skip animation for subsequent tooltips */
.tooltip[data-instant] {
  transition-duration: 0ms;
}

Radix UI and Base UI support this pattern with data-instant attribute.

Make Animations Origin-Aware

Popovers should scale from their trigger, not from center.

/* Default (wrong for most cases) */
.popover {
  transform-origin: center;
}

/* Correct - scale from trigger */
.popover {
  transform-origin: var(--transform-origin);
}

Radix UI:

.popover {
  transform-origin: var(--radix-dropdown-menu-content-transform-origin);
}

Base UI:

.popover {
  transform-origin: var(--transform-origin);
}

Speed & Timing

Keep Animations Fast

A faster-spinning spinner makes apps feel faster even with identical load times. A 180ms select animation feels more responsive than 400ms.

Rule: UI animations should stay under 300ms.

Don't Animate Keyboard Interactions

Arrow key navigation, keyboard shortcuts—these are repeated hundreds of times daily. Animation makes them feel slow and disconnected.

Never animate:

  • List navigation with arrow keys
  • Keyboard shortcut responses
  • Tab/focus movements

Be Careful with Frequently-Used Elements

A hover effect is nice, but if triggered multiple times a day, it may benefit from no animation at all.

Guideline: Use your own product daily. You'll discover which animations become annoying through repeated use.

Hover States

Fix Hover Flicker

When hover animation changes element position, the cursor may leave the element, causing flicker.

Problem:

.box:hover {
  transform: translateY(-20%);
}

Solution: Animate a child element instead:

<div class="box">
  <div class="box-inner"></div>
</div>
.box:hover .box-inner {
  transform: translateY(-20%);
}

.box-inner {
  transition: transform 200ms ease;
}

The parent's hover area stays stable while the child moves.

Disable Hover on Touch Devices

Touch devices don't have true hover. Accidental finger movement triggers unwanted hover states.

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: scale(1.05);
  }
}

Note: Tailwind v4's hover: class automatically applies only when the device supports hover.

Touch & Accessibility

Ensure Appropriate Target Areas

Small buttons are hard to tap. Use a pseudo-element to create larger hit areas without changing layout.

Minimum target: 44px (Apple and WCAG recommendation)

@utility touch-hitbox {
  position: relative;
}

@utility touch-hitbox::before {
  content: "";
  position: absolute;
  display: block;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  min-height: 44px;
  min-width: 44px;
  z-index: 9999;
}

Usage:

<button className="touch-hitbox">
  <BellIcon />
</button>

Easing Selection

Use ease-out for Enter/Exit

Elements entering or exiting should use ease-out. The fast start creates responsiveness.

.dropdown {
  transition:
    transform 200ms ease-out,
    opacity 200ms ease-out;
}

ease-in starts slow—wrong for UI. Same duration feels slower because the movement is back-loaded.

Use ease-in-out for On-Screen Movement

Elements already visible that need to move should use ease-in-out. Mimics natural acceleration/deceleration like a car.

.slider-handle {
  transition: transform 250ms ease-in-out;
}

Use Custom Easing Curves

Built-in CSS curves are usually too weak. Custom curves create more intentional motion.

Resources:

Visual Tricks

Use Blur as a Fallback

When easing and timing adjustments don't solve the problem, add subtle blur to mask imperfections.

.button-transition {
  transition:
    transform 150ms ease-out,
    filter 150ms ease-out;
}

.button-transition:active {
  transform: scale(0.97);
  filter: blur(2px);
}

Blur bridges visual gaps between states, tricking the eye into seeing smoother transitions. The two states blend instead of appearing as distinct objects.

Performance note: Keep blur under 20px, especially on Safari.

Why Details Matter

"All those unseen details combine to produce something that's just stunning, like a thousand barely audible voices all singing in tune." — Paul Graham, Hackers and Painters

Details that go unnoticed are good—users complete tasks without friction. Great interfaces enable users to achieve goals with ease, not to admire animations.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.67%
按下载量换算288

Claude

32.08%
按下载量换算275

Cursor

17.55%
按下载量换算150

Gemini CLI

8.55%
按下载量换算73

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills