本文へスキップ

TOP / MOTION LAB / スライダー

スライダー 読了目安 3分

奥行きカードスライダー

概要

アクティブなカードを手前に、後続カードを右奥へ階段状にずらして重ねる、サービス紹介・特徴訴求向けのカードスライダー。

使用技術

実装ポイント

コアスニペット

cards.forEach((card, index) => {
  const diff = (index - currentIndex + slides.length) % slides.length;
  if (diff >= maxVisible) {
    gsap.to(card, { x: 600, scale: 0.5, opacity: 0, zIndex: 0, rotateY: 20, duration: 0.6, ease: "power3.out" });
  } else {
    const translateX = diff * 190;
    const scale = 1 - diff * 0.1;
    const opacity = diff === 0 ? 1 : 1 - diff * 0.4;
    const zIndex = slides.length - diff;
    const rotateY = diff * 5;
    gsap.to(card, { x: translateX, scale, opacity, zIndex, rotateY, duration: 0.6, ease: "power3.out" });
  }
});