web-animation-view-transitions
Web Animations APIとView Transitions APIを活用し、同一ドキュメント内や複数ページ間でのスムーズな画面遷移、要素のアニメーション、擬似要素のスタイリング、アクセシビリティ対応などを実現するSkill。
📜 元の英語説明(参考)
View Transitions API patterns - same-document transitions, cross-document MPA transitions, shared element animations, pseudo-element styling, accessibility
🇯🇵 日本人クリエイター向け解説
Web Animations APIとView Transitions APIを活用し、同一ドキュメント内や複数ページ間でのスムーズな画面遷移、要素のアニメーション、擬似要素のスタイリング、アクセシビリティ対応などを実現するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o web-animation-view-transitions.zip https://jpskill.com/download/10273.zip && unzip -o web-animation-view-transitions.zip && rm web-animation-view-transitions.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10273.zip -OutFile "$d\web-animation-view-transitions.zip"; Expand-Archive "$d\web-animation-view-transitions.zip" -DestinationPath $d -Force; ri "$d\web-animation-view-transitions.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
web-animation-view-transitions.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
web-animation-view-transitionsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
View Transitions API のパターン
クイックガイド: ネイティブなページ/ステートのトランジションには View Transitions API を使用します。同一ドキュメント内では
document.startViewTransition()を、異なるドキュメント間の MPA では@view-transition { navigation: auto }を使用します。使用前に必ず機能検出を行い、prefers-reduced-motionを尊重してください。型付きのトランジションが必要な場合は、startViewTransition({ update, types })のオプション形式を使用します。
<critical_requirements>
重要: このスキルを使用する前に
すべてのコードは CLAUDE.md のプロジェクト規約に従う必要があります (kebab-case, 名前付きエクスポート, インポート順,
import type, 名前付き定数)
(startViewTransition を使用する前に必ず機能検出を行ってください - すべてのブラウザで利用できるわけではありません)
(アニメーションを減らすか無効にすることで、prefers-reduced-motion を必ず尊重してください)
(view-transition-name の値が一意であることを必ず確認してください - 重複した名前はトランジションを中断させます)
(トランジション完了後、動的に割り当てられた view-transition-name の値を必ずクリーンアップしてください)
(すべてのアニメーションタイミングの値には、名前付き定数を使用してください - マジックナンバーは使用しないでください)
</critical_requirements>
自動検出: View Transitions API, startViewTransition, view-transition-name, @view-transition, ::view-transition, pageswap, pagereveal, ViewTransition, view-transition-class, match-element, active-view-transition-type
使用場面:
- シングルページアプリケーションでの状態変化のアニメーション
- マルチページアプリケーションでのスムーズなページ間トランジションの作成
- ビュー間の共有要素(ヒーロー)アニメーションの実装
- ナビゲーション中の視覚的な連続性の提供
- カスタムトランジション効果(スライド、スケール、円形表示)の作成
カバーする主要なパターン:
- startViewTransition() を使用した同一ドキュメント内のトランジション
- @view-transition CSS を使用した異なるドキュメント間の MPA トランジション
- 共有要素アニメーションのための view-transition-name
- 疑似要素のスタイリング (::view-transition-old, ::view-transition-new)
- :active-view-transition-type() を使用した方向を意識したトランジション
- 機能検出とグレースフルフォールバック
- prefers-reduced-motion アクセシビリティパターン
使用しない場面:
- 複雑な物理ベースのアニメーション (アニメーションライブラリを使用)
- 正確なタイムライン制御を必要とするアニメーション
- 単純なホバー/フォーカス効果 (CSS トランジションを使用)
詳細なリソース:
- examples/core.md - 機能検出、状態遷移、Promise 処理、CSS カスタマイズ
- examples/spa.md - テーマスイッチャー、フォームステップ、タブパネル、リストの並べ替え
- examples/shared-elements.md - ヒーローアニメーション、複数の共有要素、MPA 共有要素、モーダル
- reference.md - 意思決定フレームワーク、疑似要素リファレンス、ブラウザサポート、アンチパターン
<philosophy>
哲学
View Transitions API は、DOM の状態またはページ間のアニメーションによるトランジションを作成するためのネイティブなブラウザメカニズムを提供します。「前」と「後」のスナップショットをキャプチャし、それらを疑似要素としてオーバーレイし、それらの間でアニメーションを行います。
コア原則:
- ライブラリよりもネイティブ - ブラウザネイティブのトランジションはよりパフォーマンスが高く、必要な JavaScript が少なくなります
- プログレッシブエンハンスメント - 常に機能検出を行い、機能的なフォールバックを提供します
- スナップショットベース - 古い状態はスクリーンショットとしてキャプチャされ、新しい状態はライブ表現としてキャプチャされます
- CSS 駆動 - JavaScript ではなく、疑似要素 CSS を通じてアニメーションをカスタマイズします
- アクセシビリティファースト - 常に prefers-reduced-motion ユーザー設定を尊重します
</philosophy>
<patterns>
コアパターン
パターン 1: フォールバック付きの機能検出
View Transitions を使用する前に、API サポートを常に確認してください。完全なユーティリティについては、examples/core.md のパターン 1 を参照してください。
const SUPPORTS_VIEW_TRANSITIONS =
typeof document !== "undefined" && "startViewTransition" in document;
function updateWithTransition(updateFn: () => void | Promise<void>): void {
if (!SUPPORTS_VIEW_TRANSITIONS) {
updateFn();
return;
}
document.startViewTransition(() => updateFn());
}
利点: サポートされていないブラウザでのランタイムエラーを防ぎ、シームレスなフォールバックを提供します
パターン 2: 同一ドキュメント (SPA) トランジション
単一ページ内で DOM の状態変化をアニメーション化します。状態遷移、非同期ロード、Promise 処理、スキップロジックについては、examples/core.md のパターン 2-5 を参照してください。
// startViewTransition は、コールバックまたはオプションオブジェクトを受け入れます
const transition = document.startViewTransition(async () => {
await updateFn();
});
// オプション形式 - CSS ターゲティングのためにタイプを設定します
const transition = document.startViewTransition({
update: () => updateDOM(),
types: ["slide-forward"],
});
await transition.finished;
ViewTransition オブジェクトは 3 つの Promise を提供します:
| Promise | 解決されるタイミング |
|---|---|
transition.ready |
疑似要素ツリーが作成されたとき |
transition.updateCallbackDone |
DOM 更新コールバックが完了したとき |
transition.finished |
アニメーションが完了したとき |
パターン 3: 異なるドキュメント (MPA) トランジション
JavaScript なしで、別々のページ間のトランジションを有効にします。両方のページがオプトインする必要があります。
/* 送信元ページと宛先ページの両方に含めます */
@view-transition {
navigation: auto;
}
利点: JavaScript は不要で、トラバース/プッシュ/リプレースナビゲーションで動作します
廃止された構文: <meta name="view-transition" content="same-origin"> - 代わりに CSS at-rule を使用してください。
パターン 4: 共有要素トランジション
一致する要素に同じ view-transition-name を与えることで、ヒーローアニメーションを作成します。製品リストから詳細、複数要素、MPA の例については、examples/shared-elements.md を参照してください。
:root {
--hero-duration: 300ms;
--hero-easing: cubic-bezier(0.4, 0, 0.2, 1);
}
/* 両方のページ/状態に同じ名前を付けると、共有要素アニメーションが作成されます */
.product-thumbnail {
view-tr 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
View Transitions API Patterns
Quick Guide: Use the View Transitions API for native page/state transitions.
document.startViewTransition()for same-document,@view-transition { navigation: auto }for cross-document MPA. Always feature-detect before use and respectprefers-reduced-motion. Use the options formstartViewTransition({ update, types })when you need typed transitions.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST feature-detect before using startViewTransition - it is NOT available in all browsers)
(You MUST respect prefers-reduced-motion by providing reduced or disabled animations)
(You MUST ensure view-transition-name values are unique - duplicate names break transitions)
(You MUST clean up dynamically assigned view-transition-name values after transitions complete)
(You MUST use named constants for all animation timing values - NO magic numbers)
</critical_requirements>
Auto-detection: View Transitions API, startViewTransition, view-transition-name, @view-transition, ::view-transition, pageswap, pagereveal, ViewTransition, view-transition-class, match-element, active-view-transition-type
When to use:
- Animating state changes in single-page applications
- Creating smooth page-to-page transitions in multi-page applications
- Implementing shared element (hero) animations between views
- Providing visual continuity during navigation
- Creating custom transition effects (slide, scale, circular reveal)
Key patterns covered:
- Same-document transitions with startViewTransition()
- Cross-document MPA transitions with @view-transition CSS
- view-transition-name for shared element animations
- Pseudo-element styling (::view-transition-old, ::view-transition-new)
- Direction-aware transitions with :active-view-transition-type()
- Feature detection and graceful fallbacks
- prefers-reduced-motion accessibility patterns
When NOT to use:
- Complex physics-based animations (use animation libraries)
- Animations requiring precise timeline control
- Simple hover/focus effects (use CSS transitions)
Detailed Resources:
- examples/core.md - Feature detection, state transitions, promise handling, CSS customization
- examples/spa.md - Theme switcher, form steps, tab panels, list reordering
- examples/shared-elements.md - Hero animations, multiple shared elements, MPA shared elements, modals
- reference.md - Decision frameworks, pseudo-element reference, browser support, anti-patterns
<philosophy>
Philosophy
The View Transitions API provides a native browser mechanism for creating animated transitions between DOM states or pages. It captures "before" and "after" snapshots, overlays them as pseudo-elements, and animates between them.
Core principles:
- Native over library - Browser-native transitions are more performant and require less JavaScript
- Progressive enhancement - Always feature-detect and provide functional fallback
- Snapshot-based - Old state is captured as a screenshot, new state as a live representation
- CSS-driven - Customize animations through pseudo-element CSS, not JavaScript
- Accessibility-first - Always respect prefers-reduced-motion user preferences
</philosophy>
<patterns>
Core Patterns
Pattern 1: Feature Detection with Fallback
Always check for API support before using View Transitions. See examples/core.md Pattern 1 for full utility.
const SUPPORTS_VIEW_TRANSITIONS =
typeof document !== "undefined" && "startViewTransition" in document;
function updateWithTransition(updateFn: () => void | Promise<void>): void {
if (!SUPPORTS_VIEW_TRANSITIONS) {
updateFn();
return;
}
document.startViewTransition(() => updateFn());
}
Why good: Prevents runtime errors in unsupported browsers, provides seamless fallback
Pattern 2: Same-Document (SPA) Transitions
Animate DOM state changes within a single page. See examples/core.md Patterns 2-5 for state transitions, async loading, promise handling, and skip logic.
// startViewTransition accepts a callback or an options object
const transition = document.startViewTransition(async () => {
await updateFn();
});
// Options form - set types for CSS targeting
const transition = document.startViewTransition({
update: () => updateDOM(),
types: ["slide-forward"],
});
await transition.finished;
ViewTransition object provides three promises:
| Promise | Resolves when |
|---|---|
transition.ready |
Pseudo-element tree created |
transition.updateCallbackDone |
DOM update callback completed |
transition.finished |
Animation complete |
Pattern 3: Cross-Document (MPA) Transitions
Enable transitions between separate pages without JavaScript. Both pages must opt in.
/* Include on BOTH source and destination pages */
@view-transition {
navigation: auto;
}
Why good: No JavaScript required, works for traverse/push/replace navigations
Obsolete syntax: <meta name="view-transition" content="same-origin"> - use the CSS at-rule instead.
Pattern 4: Shared Element Transitions
Create hero animations by giving matching elements the same view-transition-name. See examples/shared-elements.md for full product list-to-detail, multi-element, and MPA examples.
:root {
--hero-duration: 300ms;
--hero-easing: cubic-bezier(0.4, 0, 0.2, 1);
}
/* Same name on both pages/states creates shared element animation */
.product-thumbnail {
view-transition-name: product-hero;
}
.product-image {
view-transition-name: product-hero;
}
::view-transition-group(product-hero) {
animation-duration: var(--hero-duration);
animation-timing-function: var(--hero-easing);
}
Key rules: Names must be unique across the document. Clean up dynamically assigned names after transition.finished.
Pattern 5: Custom CSS Animations
Override default cross-fade with custom animations via pseudo-elements. See examples/core.md Pattern 6 for full examples.
:root {
--transition-duration: 300ms;
--transition-easing: ease-in-out;
}
::view-transition-old(root) {
animation: slide-out-left var(--transition-duration) var(--transition-easing);
}
::view-transition-new(root) {
animation: slide-in-right var(--transition-duration) var(--transition-easing);
}
Why good: CSS custom properties for timing constants, GPU-accelerated transforms
Pattern 6: Direction-Aware Transitions
Use different animations for forward vs backward navigation. Use the types parameter or ViewTransition.types set.
html:active-view-transition-type(forwards) {
&::view-transition-old(content) {
animation-name: slide-out-left;
}
&::view-transition-new(content) {
animation-name: slide-in-right;
}
}
html:active-view-transition-type(backwards) {
&::view-transition-old(content) {
animation-name: slide-out-right;
}
&::view-transition-new(content) {
animation-name: slide-in-left;
}
}
// Preferred: set types via options parameter
document.startViewTransition({
update: () => navigateForward(),
types: ["forwards"],
});
// Alternative: mutate types set on existing transition
const transition = document.startViewTransition(updateFn);
transition.types.add("forwards");
See examples/spa.md for form step and tab panel examples.
Pattern 7: Accessibility - Reduced Motion
Always respect user preferences for reduced motion.
@media (prefers-reduced-motion: reduce) {
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
animation-duration: 0.01ms !important;
}
}
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
function shouldEnableTransitions(): boolean {
if (window.matchMedia(REDUCED_MOTION_QUERY).matches) return false;
return "startViewTransition" in document;
}
See examples/spa.md for a full accessible transition wrapper with preference change monitoring.
Pattern 8: Circular Reveal Effect
Advanced custom animation using Web Animations API. Must await transition.ready before animating pseudo-elements.
const REVEAL_DURATION_MS = 400;
const REVEAL_EASING = "ease-in-out";
const transition = document.startViewTransition(updateFn);
await transition.ready;
document.documentElement.animate(
{
clipPath: [`circle(0 at ${x}px ${y}px)`, `circle(${r}px at ${x}px ${y}px)`],
},
{
duration: REVEAL_DURATION_MS,
easing: REVEAL_EASING,
pseudoElement: "::view-transition-new(root)",
},
);
See examples/spa.md for a complete theme-switcher circular reveal implementation.
</patterns>
<red_flags>
RED FLAGS
High Priority Issues:
- Missing feature detection - Calling
startViewTransition()without checking support crashes in older browsers - Duplicate view-transition-name values - Two visible elements with the same name breaks the transition entirely
- Not cleaning up dynamic names - Leftover names cause conflicts in subsequent transitions
- Ignoring prefers-reduced-motion - Mandatory for accessibility; always provide reduced or no animation
- Magic numbers for timing - All duration/delay values must be named constants or CSS custom properties
Medium Priority Issues:
- Using obsolete meta tag syntax -
<meta name="view-transition">is deprecated; use@view-transitionCSS - Not awaiting transition.ready for custom animations - Web Animations API must wait for pseudo-elements to exist
- Missing @view-transition on both MPA pages - Cross-document transitions require opt-in on source AND destination
- Setting view-transition-name in CSS for dynamic lists - Causes name conflicts; use JavaScript assignment or
match-element
Gotchas & Edge Cases:
- Old state is a screenshot - Videos, animations, GIFs freeze in the old snapshot
- New state is "live" - Interactive content continues playing in the new snapshot
- Transition names are global - Same name on different page sections will conflict
- Animations block interaction - User cannot interact until transition completes; keep animations under 300ms
- Cross-document needs same-origin - Different origins cannot share transitions
match-elementrequires Chrome 137+/Safari 18.4+ - Not yet available in Firefoxpagerevealmust be registered early - Put handler in<head>or useblocking="render"- Reserved names (
auto,inherit,none,unset) are CSS keywords, not valid custom identifiers
</red_flags>
<critical_reminders>
CRITICAL REMINDERS
All code must follow project conventions in CLAUDE.md
(You MUST feature-detect before using startViewTransition - it is NOT available in all browsers)
(You MUST respect prefers-reduced-motion by providing reduced or disabled animations)
(You MUST ensure view-transition-name values are unique - duplicate names break transitions)
(You MUST clean up dynamically assigned view-transition-name values after transitions complete)
(You MUST use named constants for all animation timing values - NO magic numbers)
Failure to follow these rules will break transitions in unsupported browsers and create inaccessible experiences.
</critical_reminders>