CSS Scroll-Driven Animations: Progress Timeline Cards
Prompt
Create an interactive timeline with cards that animate as you scroll. Each card should have a progress bar that fills based on scroll position, and the cards should fade in and slide into position. Use CSS scroll-driven animations with @scroll-timeline and animation-timeline.
CODE PREVIEW
AIとの対話に追加する一言
プロンプトと一緒にコピーして、AIがより正確に意図を汲み取れるようにします
このコードをそのまま使いたいので、CDNリンクも含めた完全なHTMLファイルとして出力してください。
初心者なので、各行にコメントを追加して、何をしているか説明してください。
このコードをWordPressのテーマに組み込む方法も教えてください。
動作確認済みのコードをお願いします。エラーが出る場合の対処法も含めて。
このインタラクティブなタイムラインは、CSSスクロール駆動アニメーションを実演しています。これはJavaScriptを使用せずにスクロール位置によってアニメーションを制御できる最新のCSS機能です。各カードはスクロールに応じてスライドイン効果で表示され、進行状況バーはそのカードのセクションを通るスクロールの進捗に比例して充填されます。
実装では、@scroll-timelineを使用してスクロールタイムラインを定義し、animation-timelineを使用してアニメーションをスクロール進捗に紐付けています。animation-rangeプロパティは、ビューポート内の要素の位置に対して各アニメーションがいつ開始・終了するかを制御します。
この技術は、モダンブラウザでネイティブに動作するスムーズでパフォーマンスの高いスクロール連動アニメーションを提供し、タイムライン、進捗インジケーター、スクロールトリガーによるコンテンツ表示などで魅力的なユーザー体験を実現します。
Prompt Overview
This prompt is designed for front-end developers who want to build visually engaging, scroll-triggered timeline interfaces using only CSS — no JavaScript required. By leveraging the modern CSS animation-timeline property and @scroll-timeline at-rule, the generated code produces cards that smoothly fade in, slide into place, and display a progress bar that fills dynamically as the user scrolls down the page. It is an excellent reference for portfolio pages, product roadmaps, event histories, or any content that benefits from a sense of progression and narrative flow.
To get the best results, use this prompt in a code-generation model such as GPT-4o or Claude, and test the output in a Chromium-based browser since scroll-driven animation support varies across engines. You can extend the prompt by specifying a color scheme, card layout direction (left-right alternating), or the number of timeline steps. It is also worth asking the model to include a fallback for unsupported browsers to ensure broad compatibility.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選