1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【HTML】パネルが画面内に入ると円が広がるスクロールアニメーションを追加する

1
Last updated at Posted at 2026-08-14

サイトの演出用に、パネルがスクロールで表示領域に入ったとき、ランダムな円が広がりながら出現するJavaScriptプラグインを作成しました。

左・右・下方向のスライドイン系プラグインなどとも、組み合わせて使用しやすい設計です。

デモはこちらです。

RandomCircleReveal デモ

JSを読み込む

<script src="https://uni928.github.io/Uni928PublicHTMLs2/Plugin/HtmlPanelEffect/Circle/random-circle-reveal.js"></script>

パネルにクラスを付ける

<section class="slide-in-left rcr-panel">
  パネルの内容
</section>

この例のslide-in-leftは、左方向のスライドインなどを行う他プラグイン用のクラスを想定しています。

RandomCircleRevealで使用するクラスはrcr-panelです。

rcr-panelを付けた要素は、スクロールによって表示領域に入ると自動的に演出が再生されます。

手動で再生する

既存のパネルアニメーションと同じタイミングで再生したい場合は、data-rcr-trigger="manual"を指定します。

<section id="panel" class="slide-in-right rcr-panel" data-rcr-trigger="manual">
  パネルの内容
</section>

<script>
  RandomCircleReveal.play(document.getElementById('panel'));
</script>

この例のslide-in-rightも、他プラグイン用のクラスを想定しています。

👇画面全体である代わりに簡単導入版

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?