本文へスキップ

TOP / MOTION LAB / スクロール

スクロール 読了目安 4分

フェードイン

概要

スクロールに合わせて要素をふわっと出現させる演出を、ポップアップ・ブラーフェード・ズーム・回転・クリップワイプ・3Dフリップなど多彩なパターンで一括提供する、汎用の登場アニメーション詰め合わせ。

使用技術

実装ポイント

コアスニペット

const applyAnimation = ({ selector, from, to, start, stagger }) => {
  // 単体アニメーション
  gsap.utils.toArray(`[data-js-${selector}]`).forEach((el) => {
    gsap.fromTo(el, from, {
      ...to,
      scrollTrigger: { trigger: el, start, toggleActions: "play none none reverse" },
    });
  });
  // 連鎖アニメーション
  gsap.utils.toArray(`[data-js-${selector}-chain]`).forEach((parent) => {
    const children = parent.querySelectorAll(":scope > *");
    gsap.fromTo(children, from, {
      ...to, stagger,
      scrollTrigger: { trigger: parent, start, toggleActions: "play none none reverse" },
    });
  });
};
animations.forEach(applyAnimation);