Lenis Smooth Scroll + Progress Indicator: AI Code Example
Prompt
Create a smooth scrolling implementation using Lenis with a scroll progress indicator that shows the current scroll position as a percentage. The indicator should be a circular progress bar that updates in real-time as the user scrolls.
CODE PREVIEW
AIとの対話に追加する一言
プロンプトと一緒にコピーして、AIがより正確に意図を汲み取れるようにします
このコードをそのまま使いたいので、CDNリンクも含めた完全なHTMLファイルとして出力してください。
初心者なので、各行にコメントを追加して、何をしているか説明してください。
このコードをWordPressのテーマに組み込む方法も教えてください。
動作確認済みのコードをお願いします。エラーが出る場合の対処法も含めて。
この実装は、Lenisライブラリを使用したスムーズスクロールと、リアルタイムのスクロール進捗インジケーターを組み合わせたものです。円形のプログレスバーは、ユーザーのスクロール位置をパーセンテージで視覚的に表現し、コンテンツを移動する際にスムーズに更新されます。
インターフェースは、グラデーション背景、グラスモーフィックカード、控えめなホバー効果を特徴としたクリーンでモダンなデザインです。ユーザーがページの20%以上スクロールすると、トップに戻るためのスクロールボタンが表示され、スムーズなアニメーションでナビゲーションを提供します。
主な機能:
- カスタマイズ可能なイージングを備えたLenisによるスムーズスクロール
- リアルタイム円形進捗インジケーター
- スクロールパーセンテージ表示
- 動的なトップへ戻るボタン
- すべてのデバイスに対応したレスポンシブデザイン
- ホバーアニメーション付きグラスモーフィックカード効果
Prompt Overview
This prompt targets front-end developers who want to elevate their web pages with polished, physics-based smooth scrolling powered by the Lenis library, paired with a real-time circular progress indicator. Instead of the browser's default abrupt scroll behavior, Lenis provides buttery, momentum-driven movement, while the circular progress bar gives users a clear, visual sense of how far they have scrolled through the page — expressed as a live percentage. The combination is a popular pattern in portfolio sites, editorial layouts, and landing pages where premium interaction design matters.
To reproduce this, paste the prompt into a capable code-generation model such as GPT-4o, Claude 3.5, or Gemini 1.5 Pro, then drop the output into a standard HTML file with CDN links for Lenis and GSAP (or a plain requestAnimationFrame loop). Useful variations include changing the indicator's position (fixed top-right vs. bottom-center), swapping the circle for a linear top progress bar, or integrating scroll-triggered animations that fire at specific percentage thresholds. This prompt is an efficient starting point for any project that prioritizes fluid, user-friendly scroll experiences.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選