UI animations necessity judgment, recommendations for motion design, implementation strategies, and performance/accessibility reviews. Targets include hover, active, focus, popover, tooltip, dropdown, dialog, tab, segmented control, card, button, toast, accordion, carousel, scroll-linked animation, View Transitions, and more.
Ships in kf-global. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
以下のようなタスクでこの Skill を使うこと。
prefers-reduced-motion を尊重すべきかどうかを判断する@starting-style, transition-behavior, interpolate-size などの出現・退場アニメーション手法を選定する@keyframes の命名規則・スコープ管理・API 的カスタムプロパティ設計を行うtransition では不十分なことがある。@keyframes animation、Web Animations API、あるいは CSS トランジションと transition-behavior の組み合わせなど、適切な手法を選ぶことprefers-reduced-motion を尊重しているユーザーにどう見せるかを常に考える必ず次を確認する。
| 目的 | 判断 | 例 |
|---|---|---|
| 状態遷移の因果関係を示す | 必要 | アコーディオン開閉、タブ切替 |
| ユーザーの注意を新出要素に誘導する | 必要 | toast 通知、バリデーションエラー |
| 操作のフィードバックを返す | 必要 | ボタンの :active、チェックボックスのチェック |
| 空間的連続性を保つ | 条件付き | ページ遷移の View Transitions、ドリルダウン |
| ブランド個性の表現 | 低頻度 UI のみ許容 | LP のヒーロー、初回訪問のオンボーディング |
| 単に見た目の華やかさ | 高頻度 UI では不要 | ダッシュボードのカードがスライドして現れるなど |
強い理由がない場合は、削除を提案すること。
イージング
ease-in 系や linear 系は物理的に不自然で機械的な印象を与えがちである。linear は一定速度を表現したい連続運動(marquee やプログレスバー)にのみ適用する。ease-out 系を使用するease-in-out 系を使用するease, ease-in-out など)はメリハリが弱い。プロジェクトにアニメーショントークンがある場合はそれを参照し、quint 系か expo 系のイージングを使用する
/* ease-out 系(出現・退場向き) */
--ease--out-quint: cubic-bezier(0.22, 1, 0.36, 1);
--ease--out-expo: cubic-bezier(0.16, 1, 0.3, 1);
/* ease-in-out 系(移動向き) */
--ease--in-out-quint: cubic-bezier(0.86, 0, 0.07, 1);
--ease--in-out-expo: cubic-bezier(0.87, 0, 0.13, 1);
transition-duration と transition-timing-function を適用するのは雑である。プロパティごとにカーブを選び分けることタイミング
300ms〜500ms を許容する100ms の差でも体感負荷が大きくなるtransform-origin は常にトリガーとの位置関係を考慮して設定するcenter は多くの場合に不適切である
transform-origin を動的に切り替えることを検討するscale: 0 からのスケールインは物理的に不自然である。「そこにあったものが少し離れた位置から立ち上がる」ほうが自然であるため、要素のサイズに応じた起点値を選ぶこと| 要素種別 | スケールイン起点 |
|---|---|
| tooltip, popover | 0.95〜0.98 |
| dropdown menu | 0.92〜0.96 |
| dialog, drawer, sheet | 0.85〜0.92 |
ホバー
150ms〜200ms を目安とする@media (any-hover: hover) で切り分けることを検討する
href が存在しないアンカーリンクでホバーが起こるのは避ける。必ず :any-link:hover のように定義すること:enabled:hover のように定義することactive(押下フィードバック)
scale: 0.96〜0.98 程度の短い縮小を挟むことで、押下されたことへの物理的なフィードバックを提示する100ms〜150ms を目安とするfocus / keyboard
:not(:focus-visible) 内で transition や animation を定義し、キーボードフォーカス時にはアニメーションが適用されないようにするtooltip
300ms〜500ms 遅延させる0ms〜50ms で即時表示する300ms〜500ms で、この間に別のトリガーに触れた場合は即時表示を継続する出現・退場(display の切替を伴う場合)
display: none から表示状態へのアニメーションには @starting-style で初期スタイルを定義し、transition-behavior: allow-discrete で display や overlay をトランジション可能にする[popover])や <dialog> のアニメーションでは、この手法を第一候補とする@starting-style は詳細度を生成しないことを留意するdisplay: none への transition は Firefox、@keyframes 内の display は Safari で動作しない。前者はプログレッシブ・エンハンスメントとして許容する高さのアニメーション(accordion 等)
height: auto へのアニメーションには interpolate-size: allow-keywords の使用を検討するgrid-template-rows: 0fr / 1fr パターンにフォールバックするscroll-linked animation
animation-timeline, view-timeline 等)IntersectionObserver による状態トグル + CSS transition/animationscrollTop を毎フレーム読んでアニメーションを駆動している実装には必ず警告することIntersectionObserverrequestAnimationFrame で制御する)IntersectionObserver による状態トグルで発火させる場合は、animation-fill-mode: both と animation-play-state: paused を組み合わせた初期非表示パターンを使う.reveal {
animation-name: --fade-in, --translate-from;
animation-duration: 600ms;
animation-timing-function: var(--ease--out-quint);
animation-fill-mode: both;
animation-play-state: paused;
/* アクティブ時に発火 */
&[data-revealed="true"] {
animation-play-state: initial;
}
}
animation-fill-mode: both により、paused 状態でも keyframes の from フレームが適用される。これにより要素は keyframes 上の開始地点(例: opacity: 0, translate: 0 20px)で描画されるanimation-play-state を initial(= running)に戻すだけでアニメーションが発火するopacity: 0 等を別途記述する必要がないこと。アニメーションの開始地点がそのまま初期表示となるため、keyframes を単一の情報源(single source of truth)として扱える@media (prefers-reduced-motion: reduce) では animation-play-state の制御ごと無効化するか、アニメーションをフェードのみに簡素化することView Transitions
document.startViewTransition() を、MPA では @view-transition at-rule を使用するview-transition-name の命名は CSS カスタムプロパティの命名規則に準じる@keyframes の命名と設計@keyframes はグローバルスコープで動作するため、命名と管理にルールを設けること。
設計原則
animation-name のカンマ区切りで組み合わせるfrom / to の 2 フレームで完結するものに限定する。中間フレームを含む keyframes はコンポーネントなどのローカルとして定義するfrom や to は省略する。省略されたフレームには要素の現在値が使われるため、カスケーディングに沿った自然なアニメーションになる。値をハードコードすると、要素の現在値が想定と異なる場合にジャンプが発生する/* グローバル keyframes(base/keyframes.css に配置) */
@keyframes --scale-from {
from {
scale: var(--scale-from--x-value, 1) var(--scale-from--y-value, 1);
}
}
/* 利用側: カスタムプロパティで起点を注入 */
[popover] {
--scale-from--x-value: 0.96;
--scale-from--y-value: 0.96;
animation-name: --scale-from;
animation-duration: 200ms;
animation-timing-function: var(--ease--out-quint);
animation-fill-mode: both;
}
その他
animation-fill-mode を明示する場合は both を第一候補とすることを推奨する必ず次の観点で考えること。
| 優先度 | 手法 | 備考 |
|---|---|---|
| 高 | compositor で処理される transform, opacity, 一部の filter, 一部の clip-path, CSS scroll-driven animations | GPU 合成のみで完結 |
| 中 | JS から transform / opacity を更新する実装、FLIP パターン | main thread が関与するが layout/paint は最小 |
| 低 | paint を起こすプロパティ(background-color, box-shadow 等) | 描画コストは面積に依存。ホバーなどでは許容する |
| 避ける | layout を起こすプロパティ(width, height, padding, inset 等) | accordion 等やむを得ない場合を除く |
| リスク大 | 大きい半径の blur() / backdrop-filter、巨大な composited layer、グローバル CSS カスタムプロパティの毎フレーム更新、scrollTop を毎フレーム読む scroll-linked animation |
filter / backdrop-filter の注意filter はハードウェアアクセラレーションされる場合があっても、コストが低いわけではないbackdrop-filter は filter よりもさらに高コストになり得る。背面の描画面積全体を再描画するためであるbackdrop-filter は特に注意)@property で inherits: false を設定して継承をオフにするwill-change の扱いwill-change はアニメーション開始直前に付与し、完了後に除去するのが原則であるwill-change は使用せず、どうしても必要な場合のみ JS で取り除く処理を必須としつつ使用することcontain の活用contain: content を指定してレイアウト・描画・スタイル計算の影響範囲を限定する。ただし機械的に指定するのではなく、以下の副作用には注意する必要がある
position: fixed はトップレイヤーを除いて absolute のように扱われるtransform の独立プロパティtranslate, rotate, scale)を使用するtransform を使用してよい
skew() を使用する場合操作中にアニメーションが完了する前に次のインタラクションが発生した場合の挙動を考慮すること。
| 状況 | 推奨挙動 | 実装手法 |
|---|---|---|
| hover → 即 unhover | 中間状態から逆再生 | CSS transition |
| dialog 開く → 即閉じる | 中間状態から退場アニメーション開始 | @starting-style + transition なら自動。@keyframes の場合は animation-fill-mode と JS 制御が必要 |
| タブ切替の連打 | 即座に切り替え、アニメーションをスキップ | animation: none の強制リセット、または View Transitions の skipTransition() |
| スクロール方向の急変 | 現在位置から新しい方向に即追従 | CSS scroll-driven animations なら自動追従 |
transition は中間状態からの逆再生が自動で行われるため、中断が頻発する UI では transition を優先する@keyframes animation は中断制御が難しいため、中断が想定される UI では避けるか、Web Animations API で cancel() / reverse() を使う100ms〜150ms)か、スキップする仕組みを入れるprefers-reduced-motion を尊重しているか?全てのアニメーションを一律に無効化するのではなく、段階的に対応すること。
| 対応レベル | 内容 | 対象例 |
|---|---|---|
| 無効化 | @media (prefers-reduced-motion: no-preference) 内でのみ定義 | パララックス、自動ループカルーセル、marquee、transform 系の scroll-linked animation |
| 簡素化 | 動きを crossfade やフェードのみに置き換え | ページ遷移の View Transitions、大型 UI の出現・退場 |
| 短縮 | duration を大幅に短縮(50ms 以下) | tooltip/popover のフェードイン |
| 維持 | 変更不要 | スピナー、プログレスバー、フォーカスリングの表示 |
以下のいずれかに該当する場合は「大きな変動」とみなし、無効化または簡素化する。
scale の変化量が 0.5 以上)transform 系のアニメーション@media (prefers-reduced-motion: no-preference) 内で定義すること全ての Step を通過した後、最終チェックとして次を確認する。
transform-origin がトリガーと合っているかscale: 0 からなど)will-change の適切な管理)prefers-reduced-motion を尊重しているユーザーにとって適切かanimation-fill-mode: both + animation-play-state: paused パターンを使い、keyframes 外に opacity: 0 等を二重定義していないか@keyframes のスコープと配置場所は適切かtransition or @keyframes or @starting-style)/ CSS + JS / Web Animations API / FLIP@keyframes 使用時): スコープ(グローバル or コンポーネント固有)/ API 的カスタムプロパティの要否transform / clip-path / observer / ローカル変数 / @property などWhat SKILL.md sets; muted values are Claude Code's defaults
/kf-global:kf-g-css-tak-animationsfrom kf-global
npx claudepluginhub melumuccu/ai --plugin kf-global14 skills in this plugin
/kf-g-artifacts-creation-rulesMandatory authoring and workflow rules for creating artifacts (HTML documents, reports, specs, visual summaries, and standalone deliverables). Always use this skill before drafting, revising, or archiving any artifact to follow the visual-first layout with diagrams/tables/screenshots, plain high-school-level Japanese vocabulary, short concise sentences, and the local HTML artifact workflow (~/artifacts placement, sequential filename reservation, Tailscale viewer URL linking, and post-task archiving)./kf-g-artifacts-sanitizeUse this skill when creating artifacts. Apply it to revise those artifacts so they read as natural, standalone deliverables and do not leak prompt instructions, conversation history, implementation constraints, or production-process traces./kf-g-css-flex-gridOther plugins' skills for the same job