AIGPAIGP

View Transitions API: Morphing Navigation with Shared Elements

P

Prompt

Create a multi-page navigation with View Transitions API where specific elements morph between pages. Implement a main navigation with 3 pages (Home, About, Contact) where the active page indicator smoothly transforms between navigation items during page transitions. Include a shared hero section that maintains visual continuity with subtle size/position changes. Add a content card that appears differently on each page but transitions smoothly with shared element transitions.

CODE PREVIEW

Customize Code with AI

AI rewrites this code based on your instructions. Preview is free; copy & download unlocked for ¥100.

AIとの対話に追加する一言

プロンプトと一緒にコピーして、AIがより正確に意図を汲み取れるようにします

このコードをそのまま使いたいので、CDNリンクも含めた完全なHTMLファイルとして出力してください。

初心者なので、各行にコメントを追加して、何をしているか説明してください。

このコードをWordPressのテーマに組み込む方法も教えてください。

動作確認済みのコードをお願いします。エラーが出る場合の対処法も含めて。

This implementation demonstrates advanced usage of the View Transitions API with shared element transitions and morphing navigation. The key features include:

Shared Element Transitions

The hero section, page title, hero text, and content card all have unique view-transition-name properties, allowing them to be tracked as shared elements during page transitions. The View Transitions API automatically creates smooth animations between these elements as they change position, size, and content.

Morphing Navigation Indicator

The active page indicator smoothly transforms between navigation items using CSS transforms. When a user clicks a different navigation link, the indicator animates to the new position with a custom easing function, creating a fluid morphing effect.

Page-Specific Styling

Each page (Home, About, Contact) has distinct styling for the content card and hero section. Despite these visual differences, the View Transitions API maintains continuity by smoothly transitioning between the different states.

Programmatic Transitions

The navigation is handled programmatically using document.startViewTransition(), allowing for custom transition logic and fallback behavior for browsers that don't support the API.

Performance Considerations

View Transitions API uses hardware acceleration for smooth animations. The implementation includes proper cleanup and error handling to ensure robust behavior across different browsing scenarios.

Was this prompt helpful?

Comments

Comments appear after moderation

この記事が役に立ったら投げ銭で応援

Apple Pay / Google Pay / クレジットカード対応 · Stripeで安全に決済

開発者が選ぶ最強ツール集

運営者が毎日使っているツール・ガジェット 6選

見る
Homeヘルプ
View Transitions API: Morphing Navigation with Shared Elements | 探せる、試せる、生成AIプロンプト集-AIGP | 探せる、試せる、生成AIプロンプト集-AIGP