Codrops 원본

Creating 3D Scroll-Driven Text Animations with CSS and GSAP

텍스트 · MIT

텍스트 더 보기
ORIGINAL PREVIEW
Creating 3D Scroll-Driven Text Animations with CSS and GSAP 정적 미리보기

갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.

큰 화면으로 보기 새 탭

SOURCE FILES

원본 코드 읽기

15개 파일

수집한 원본 소스와 실행 안내를 함께 제공합니다.

css/base.css
파일 저장

*,
*::after,
*::before {
  box-sizing: border-box;
}

:root {
  --color-text: #fff;
  --color-text-alt: rgba(255, 255, 255, 0.7);
  --color-bg: #000;
  --color-link: #ffffff95;
  --color-link-hover: #fff;
  --page-padding: 1.5rem;
  --section-padding: 3.2rem;
  font-family: 'area-normal', sans-serif;
  font-size: 12px;
  line-height: 1;
}

body {
  margin: 0;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
  height: 100%;
}

.demo-1 {
  --color-bg: #4b45af;
}

.demo-2 {
  --color-text: #c21010;
}

.demo-3 {
  --color-bg: #151212;
}

a {
  text-decoration: none;
  color: var(--color-link);
  outline: none;
  cursor: pointer;

  &:hover {
    text-decoration: underline;
    color: var(--color-link-hover);
  }

  &:focus {
    outline: none;
    background: lightgrey;

    &:not(:focus-visible) {
      background: transparent;
    }

    &:focus-visible {
      outline: 2px solid red;
      background: transparent;
    }
  }
}

.frame {
  font-weight: 500;
  padding: 3rem var(--page-padding) 0;
  display: grid;
  z-index: 1000;
  position: relative;
  gap: 1rem;
  pointer-events: none;
  justify-items: start;
  justify-content: start;
  grid-template-columns: auto auto auto;
  grid-template-areas:
    'title title title'
    'back archive github'
    'demos demos demos'
    'tags tags tags'
    'sponsor sponsor sponsor';

  #cdawrap {
    justify-self: start;
    grid-area: sponsor;
  }

  a,
  button {
    pointer-events: auto;
  }

  .frame__title {
    grid-area: title;
    font-size: inherit;
    margin: 0;
  }

  .frame__back {
    grid-area: back;
    justify-self: start;
  }

  .frame__archive {
    grid-area: archive;
    justify-self: start;
  }

  .frame__github {
    grid-area: github;
  }

  .frame__tags {
    grid-area: tags;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .frame__demos {
    grid-area: demos;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

    & a {
      opacity: 0.5;
      &.active {
        opacity: 1;
      }
    }
  }

  @media screen and (min-width: 53em) {
    padding: var(--page-padding);
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    grid-template-columns: auto auto auto auto 1fr;
    grid-template-rows: auto auto;
    align-content: space-between;
    grid-template-areas:
      'title back github archive demos'
      'tags tags tags sponsor sponsor';

    .frame__tags {
      align-self: end;
    }

    .frame__demos,
    #cdawrap {
      justify-self: end;
      text-align: right;
      max-width: 225px;
      line-height: 1.4;
    }
  }
}

.content {
  word-break: break-all;
  padding: 0;
  max-width: 90em;
  margin: 0 auto;
  overflow-x: hidden;

  @media screen and (max-width: 768px) {
    padding: 0 var(--page-padding);
    width: 100%;
  }

  @media screen and (min-width: 1440px) {
    max-width: 120em;
  }
}

.section {
  width: 100%;
  height: 100vh;
  position: relative;

  display: flex;
  flex-direction: column;
  gap: 3vh;
  justify-content: center;
  align-items: center;

  & h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    text-align: center;
    word-break: break-word;
    font-weight: 600;
    line-height: 1;
  }

  & p {
    text-align: center;
    word-break: break-word;
    font-weight: 400;
    color: var(--color-text-alt);
  }
}
index.html
파일 저장

<!DOCTYPE html>
<html lang="en" class="no-js">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>3D Text Animation on Scroll | Cylinder | Codrops</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="author" content="Codrops" />
    <link rel="shortcut icon" href="https://tympanus.net/favicon/favicon.ico" />
    <link rel="stylesheet" href="https://use.typekit.net/igx2nek.css" />
    <link rel="stylesheet" type="text/css" href="css/base.css" />
    <script>
      document.documentElement.className = 'js';
    </script>
  </head>

  <body class="demo-1">
    <main id="smooth-wrapper">
      <header class="frame">
        <h1 class="frame__title">3D Text Animation on Scroll</h1>
        <a class="frame__back" href="https://tympanus.net/codrops/?p=102598">Article</a>
        <a class="frame__archive" href="https://tympanus.net/codrops/hub/">All demos</a>
        <a class="frame__github" href="https://github.com/davidfaure/3d-text-animation-codrops/">GitHub</a>
        <nav class="frame__tags">
          <a href="https://tympanus.net/codrops/demos/?tag=scroll">#scroll</a>
          <a href="https://tympanus.net/codrops/demos/?tag=3d">#3D</a>
          <a href="https://tympanus.net/codrops/demos/?tag=gsap">#gsap</a>
        </nav>
        <nav class="frame__demos">
          <span class="active">Demo 1</span>
          <a href="./index2.html">Demo 2</a>
          <a href="./index3.html">Demo 3</a>
        </nav>
      </header>
      <div id="smooth-content" class="content">
        <section class="section">
          <h1>
            Cylinder Text
            <br />
            Scroll Animation
          </h1>
          <p>Scroll down</p>
        </section>
        <section class="cylinder__wrapper">
          <p class="cylinder__title">Keep scrolling to see the animation</p>
          <ul class="cylinder__text__wrapper">
            <li class="cylinder__text__item">Vinny Blaze</li>
            <li class="cylinder__text__item">Lola Vance</li>
            <li class="cylinder__text__item">Rex Delgado</li>
            <li class="cylinder__text__item">Ruby Knox</li>
            <li class="cylinder__text__item">Mickey Torque</li>
            <li class="cylinder__text__item">Joey Marlowe</li>
            <li class="cylinder__text__item">Scarlet Dune</li>
            <li class="cylinder__text__item">Bobby Vega</li>
            <li class="cylinder__text__item">Cass Nova</li>
            <li class="cylinder__text__item">Lance Fury</li>
            <li class="cylinder__text__item">Frankie Valence</li>
            <li class="cylinder__text__item">Nina Rocco</li>
          </ul>
        </section>
        <section class="section">
          <a href="./index2.html"><h1>Next Effect: Double Circular</h1></a>
        </section>
      </div>
    </main>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
함께 쓰는 파일 13개 보기
index2.html
파일 저장

<!DOCTYPE html>
<html lang="en" class="no-js">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>3D Text Animation on Scroll | Circle | Codrops</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="author" content="Codrops" />
    <link rel="shortcut icon" href="https://tympanus.net/favicon/favicon.ico" />
    <link rel="stylesheet" href="https://use.typekit.net/igx2nek.css" />
    <link rel="stylesheet" type="text/css" href="css/base.css" />
    <script>
      document.documentElement.className = 'js';
    </script>
  </head>

  <body class="demo-2">
    <main id="smooth-wrapper">
      <header class="frame">
        <h1 class="frame__title">3D Text Animation on Scroll</h1>
        <a class="frame__back" href="https://tympanus.net/codrops/?p=102598">Article</a>
        <a class="frame__archive" href="https://tympanus.net/codrops/hub/">All demos</a>
        <a class="frame__github" href="https://github.com/davidfaure/3d-text-animation-codrops/">GitHub</a>
        <nav class="frame__tags">
          <a href="https://tympanus.net/codrops/demos/?tag=scroll">#scroll</a>
          <a href="https://tympanus.net/codrops/demos/?tag=3d">#3D</a>
          <a href="https://tympanus.net/codrops/demos/?tag=gsap">#gsap</a>
        </nav>
        <nav class="frame__demos">
          <a href="./index.html">Demo 1</a>
          <span class="active">Demo 2</span>
          <a href="./index3.html">Demo 3</a>
        </nav>
      </header>
      <div id="smooth-content" class="content">
        <section class="section">
          <h1>
            Circle Text
            <br />
            Scroll Animation
          </h1>
          <p>Scroll down</p>
        </section>
        <section class="circle__wrapper">
          <ul class="circle__text__wrapper__left">
            <li class="circle__text__left__item">Jean Morel</li>
            <li class="circle__text__left__item">Claire Monet</li>
            <li class="circle__text__left__item">Lucie Marin</li>
            <li class="circle__text__left__item">André Roche</li>
            <li class="circle__text__left__item">Hélène Vidal</li>
            <li class="circle__text__left__item">Pierre Noel</li>
            <li class="circle__text__left__item">Marcel Duroc</li>
            <li class="circle__text__left__item">Simone Rey</li>
            <li class="circle__text__left__item">Lucien Arto</li>
            <li class="circle__text__left__item">Colette Fay</li>
            <li class="circle__text__left__item">Henri Blanc</li>
            <li class="circle__text__left__item">Marie Roche</li>
            <li class="circle__text__left__item">René Duval</li>
            <li class="circle__text__left__item">Juliette Roy</li>
            <li class="circle__text__left__item">Alain Giroux</li>
            <li class="circle__text__left__item">Sylvie Moret</li>
            <li class="circle__text__left__item">Jacques Lenoir</li>
            <li class="circle__text__left__item">Monique Barel</li>
            <li class="circle__text__left__item">Claude Verne</li>
            <li class="circle__text__left__item">Odette Perrin</li>
            <li class="circle__text__left__item">Pauline Arcy</li>
            <li class="circle__text__left__item">Victor Lamy</li>
            <li class="circle__text__left__item">Bernard Faye</li>
            <li class="circle__text__left__item">Aimée Duret</li>
          </ul>

          <ul class="circle__text__wrapper__right">
            <li class="circle__text__right__item">Émile Ravel</li>
            <li class="circle__text__right__item">Camille Dorny</li>
            <li class="circle__text__right__item">Sophie Lalot</li>
            <li class="circle__text__right__item">Gaston Merle</li>
            <li class="circle__text__right__item">Estelle Dupre</li>
            <li class="circle__text__right__item">Lucien Beart</li>
            <li class="circle__text__right__item">Thérèse Loup</li>
            <li class="circle__text__right__item">Raymond Vallé</li>
            <li class="circle__text__right__item">Odile Garnet</li>
            <li class="circle__text__right__item">Maurice Leno</li>
            <li class="circle__text__right__item">Irène Faure</li>
            <li class="circle__text__right__item">Charles Duret</li>
            <li class="circle__text__right__item">Elise Corbin</li>
            <li class="circle__text__right__item">Roland Marec</li>
            <li class="circle__text__right__item">Delphine Noé</li>
            <li class="circle__text__right__item">François Borel</li>
            <li class="circle__text__right__item">Nathalie Cour</li>
            <li class="circle__text__right__item">Georges Leval</li>
            <li class="circle__text__right__item">Solange Bret</li>
            <li class="circle__text__right__item">Étienne Dupré</li>
            <li class="circle__text__right__item">Renée Marchal</li>
            <li class="circle__text__right__item">Antoine Lory</li>
            <li class="circle__text__right__item">Michèle Arcy</li>
            <li class="circle__text__right__item">Pascal Duret</li>
          </ul>
        </section>
        <section class="section">
          <a href="./index3.html"><h1>Next Effect: Tube Circular</h1></a>
        </section>
      </div>
    </main>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
index3.html
파일 저장

<!DOCTYPE html>
<html lang="en" class="no-js">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>3D Animation Text | Demo 3 | Codrops</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="author" content="Codrops" />
    <link rel="shortcut icon" href="https://tympanus.net/favicon/favicon.ico" />
    <link rel="stylesheet" href="https://use.typekit.net/igx2nek.css" />
    <link rel="stylesheet" type="text/css" href="css/base.css" />
    <script>
      document.documentElement.className = 'js';
    </script>
  </head>
  <body class="demo-3">
    <main id="smooth-wrapper">
      <header class="frame">
        <h1 class="frame__title">3D Text Animation on Scroll</h1>
        <a class="frame__back" href="https://tympanus.net/codrops/?p=102598">Article</a>
        <a class="frame__archive" href="https://tympanus.net/codrops/hub/">All demos</a>
        <a class="frame__github" href="https://github.com/davidfaure/3d-text-animation-codrops/">GitHub</a>
        <nav class="frame__tags">
          <a href="https://tympanus.net/codrops/demos/?tag=scroll">#scroll</a>
          <a href="https://tympanus.net/codrops/demos/?tag=3d">#3D</a>
          <a href="https://tympanus.net/codrops/demos/?tag=gsap">#gsap</a>
        </nav>
        <nav class="frame__demos">
          <a href="./index.html">Demo 1</a>
          <a href="./index2.html">Demo 2</a>
          <span class="active">Demo 3</span>
        </nav>
      </header>
      <div id="smooth-content" class="content">
        <section class="section">
          <h1>
            Tube Text
            <br />
            Scroll Animation
          </h1>
          <p>Scroll down</p>
        </section>
        <section class="tube__wrapper">
          <ul class="tube__text__wrapper">
            <li class="tube__text__item">Coco</li>
            <li class="tube__text__item">Maria</li>
            <li class="tube__text__item">Dan</li>
            <li class="tube__text__item">Miko</li>
            <li class="tube__text__item">Vigo</li>
            <li class="tube__text__item">Coco</li>
            <li class="tube__text__item">Maria</li>
            <li class="tube__text__item">Dan</li>
            <li class="tube__text__item">Miko</li>
            <li class="tube__text__item">Vigo</li>
          </ul>
        </section>
        <section class="section">
          <a href="./index1.html"><h1>Next Effect: Cylindar</h1></a>
        </section>
      </div>
    </main>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
src/circle/circle.css
파일 저장

.circle__wrapper {
  width: 100%;
  height: 100svh;
  position: relative;
}

.circle__wrapper ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.circle__text__wrapper__left {
  position: absolute;
  width: 100vw;
  height: 100%;
  left: 30%;
  transform: translateX(-100%);

  @media screen and (max-width: 768px) {
    font-size: 1.2rem;
  }

  @media screen and (max-width: 425px) {
    font-size: 1rem;
  }
}

.circle__text__wrapper__right {
  position: absolute;
  width: 100vw;
  height: 100%;
  left: 70%;
  text-align: right;

  @media screen and (max-width: 768px) {
    font-size: 1.2rem;
  }

  @media screen and (max-width: 425px) {
    font-size: 1rem;
  }
}

.circle__text__left__item,
.circle__text__right__item {
  position: absolute;
  font-family: 'bc-ludva', sans-serif;
  font-weight: 400;
  font-size: clamp(1.5rem, 5vw, 6rem);
  text-transform: uppercase;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  width: 25rem;

  @media screen and (max-width: 768px) {
    width: 15rem;
  }

  @media screen and (max-width: 425px) {
    width: 10rem;
  }
}
src/circle/circle.ts
파일 저장

import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";

interface CircleConfig {
  wrapper: HTMLElement;
  items: NodeListOf<HTMLElement>;
  radius: number;
  direction: number;
}

export class Circle {
  leftConfig: CircleConfig;
  rightConfig: CircleConfig;
  centerX!: number;
  centerY!: number;

  constructor() {
    this.leftConfig = {
      wrapper: document.querySelector(
        ".circle__text__wrapper__left"
      ) as HTMLElement,
      items: document.querySelectorAll(".circle__text__left__item"),
      radius: 0,
      direction: 1,
    };

    this.rightConfig = {
      wrapper: document.querySelector(
        ".circle__text__wrapper__right"
      ) as HTMLElement,
      items: document.querySelectorAll(".circle__text__right__item"),
      radius: 0,
      direction: -1,
    };

    this.updateDimensions();
    this.init();
  }

  init(): void {
    if (!this.leftConfig.wrapper || !this.rightConfig.wrapper) return;
    this.calculateInitialPositions();
    this.createScrollAnimations();
  }

  updateDimensions(): void {
    if (!this.leftConfig.wrapper || !this.rightConfig.wrapper) return;
    this.centerX = window.innerWidth / 2;
    this.centerY = window.innerHeight / 2;
    this.leftConfig.radius = this.leftConfig.wrapper.offsetWidth / 2;
    this.rightConfig.radius = this.rightConfig.wrapper.offsetWidth / 2;
  }

  calculateInitialPositions(): void {
    this.updateItemsPosition(this.leftConfig, 0);
    this.updateItemsPosition(this.rightConfig, 0);
  }

  updateItemsPosition(config: CircleConfig, scrollY: number): void {
    const { items, radius, direction } = config;
    const totalItems = items.length;
    const spacing = Math.PI / totalItems;

    items.forEach((item, index) => {
      const angle = index * spacing - scrollY * direction * Math.PI * 2;
      const x = this.centerX + Math.cos(angle) * radius;
      const y = this.centerY + Math.sin(angle) * radius;

      const rotationOffset = direction === -1 ? 180 : 0;
      const rotation = (angle * 180) / Math.PI + rotationOffset;

      gsap.set(item, {
        x,
        y,
        rotation,
        transformOrigin: "center center",
      });
    });
  }

  createScrollAnimations(): void {
    ScrollTrigger.create({
      trigger: ".circle__wrapper",
      start: "top bottom",
      end: "bottom top",
      scrub: 1,
      onUpdate: (self) => {
        const scrollY = self.progress * 0.5;
        this.updateItemsPosition(this.leftConfig, scrollY);
        this.updateItemsPosition(this.rightConfig, scrollY);
      },
    });
  }

  resize(): void {
    this.updateDimensions();
    this.calculateInitialPositions();
  }
}
src/cylinder/cylinder.css
파일 저장

.cylinder__title {
  color: var(--color-link);
  display: none;
}

.cylinder__wrapper {
  width: 100%;
  height: 100svh;
  position: relative;
  perspective: 1000px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10rem;
}

.cylinder__text__wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: center center;
  text-align: center;
}

.cylinder__text__item {
  font-size: clamp(3rem, 9vw, 7rem);
  font-family: 'rl-folklor', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  backface-visibility: hidden;
}
src/cylinder/cylinder.ts
파일 저장

import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';

export class Cylinder {
  title: HTMLElement;
  textWrapper: HTMLElement;
  textItems: NodeListOf<HTMLElement>;
  wrapper: HTMLElement;

  constructor() {
    this.title = document.querySelector('.cylinder__title') as HTMLElement;
    this.textWrapper = document.querySelector('.cylinder__text__wrapper') as HTMLElement;
    this.textItems = document.querySelectorAll('.cylinder__text__item') as NodeListOf<HTMLElement>;
    this.wrapper = document.querySelector('.cylinder__wrapper') as HTMLElement;
    this.init();
  }

  init(): void {
    if (!this.title || !this.textWrapper) return;
    this.calculatePositions();
    this.createScrollTrigger();
  }

  calculatePositions(): void {
    const offset = 0.4;
    const radius = Math.min(window.innerWidth, window.innerHeight) * offset;
    const spacing = 180 / this.textItems.length;

    this.textItems.forEach((item, index) => {
      const angle = (index * spacing * Math.PI) / 180;
      const rotationAngle = index * -spacing;

      const x = 0;
      const y = Math.sin(angle) * radius;
      const z = Math.cos(angle) * radius;

      item.style.transform = `translate3d(-50%, -50%, 0) translate3d(${x}px, ${y}px, ${z}px) rotateX(${rotationAngle}deg)`;
    });
  }

  createScrollTrigger(): void {
    ScrollTrigger.create({
      trigger: this.title,
      start: 'center center',
      end: '+=2000svh',
      pin: this.wrapper,
      scrub: 2,
      animation: gsap.fromTo(this.textWrapper, { rotateX: -80 }, { rotateX: 270, ease: 'none' }),
    });
  }

  resize(): void {
    this.calculatePositions();
  }
}
src/main.ts
파일 저장

import './cylinder/cylinder.css';
import './circle/circle.css';
import './tube/tube.css';

import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
import { ScrollSmoother } from 'gsap/ScrollSmoother';

import { Cylinder } from './cylinder/cylinder';
import { Circle } from './circle/circle';
import { Tube } from './tube/tube';

class App {
  smoother!: ScrollSmoother;
  cylinder!: Cylinder;
  circle!: Circle;
  tube!: Tube;

  constructor() {
    gsap.registerPlugin(ScrollTrigger, ScrollSmoother);

    this.init();
    this.addEventListeners();
  }

  init(): void {
    this.setupScrollSmoother();
    this.initAllEffects();
  }

  setupScrollSmoother(): void {
    this.smoother = ScrollSmoother.create({
      smooth: 1,
      effects: true,
    });
  }

  initAllEffects(): void {
    this.cylinder = new Cylinder();
    this.circle = new Circle();
    this.tube = new Tube();
  }

  addEventListeners(): void {
    window.addEventListener('resize', () => {
      this.cylinder.resize();
      this.circle.resize();
      this.tube.resize();
    });
  }
}

new App();
src/tube/tube.css
파일 저장

.tube__wrapper {
  width: 100%;
  height: 100svh;
  position: relative;
  perspective: 1000px;
  overflow: hidden;
}

.tube__wrapper ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tube__wrapper ul li {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tube__text__wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  font-size: clamp(1.25rem, 6vw, 3.5rem);
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  transform-style: preserve-3d;
  transform-origin: center center;
}

.tube__text__item {
  position: absolute;
  top: 50%;
  width: 100%;
}
src/tube/tube.ts
파일 저장

import { ScrollTrigger } from "gsap/ScrollTrigger";

export class Tube {
  private items: NodeListOf<HTMLElement>;
  private textWrapper: HTMLElement;
  private wrapper: HTMLElement;

  constructor() {
    this.wrapper = document.querySelector(".tube__wrapper") as HTMLElement;
    this.textWrapper = document.querySelector(
      ".tube__text__wrapper"
    ) as HTMLElement;
    this.items = document.querySelectorAll(".tube__text__item");

    this.init();
  }

  private init(): void {
    if (!this.wrapper) return;
    this.calculatePositions();
    this.createScrollTrigger();
  }

  private calculatePositions(): void {
    const offset = 0.4;
    const radius = Math.min(window.innerWidth, window.innerHeight) * offset;
    const spacing = 360 / this.items.length;

    this.items.forEach((item, index) => {
      const angle = (index * spacing * Math.PI) / 180;

      const x = Math.sin(angle) * radius;
      const y = 0;
      const z = Math.cos(angle) * radius;
      const rotationY = index * spacing;

      item.style.transform = `translate3d(${x}px, ${y}px, ${z}px) rotateY(${rotationY}deg)`;
    });
  }

  createScrollTrigger(): void {
    ScrollTrigger.create({
      trigger: this.wrapper,
      start: "top bottom",
      end: "bottom top",
      scrub: 1,
      onUpdate: (self) => {
        const rotation = self.progress * 360;
        this.textWrapper.style.transform = `rotateZ(15deg) rotateY(${rotation}deg)`;
      },
    });
  }

  public resize(): void {
    this.calculatePositions();
  }
}
vite.config.js
파일 저장

import { fileURLToPath } from "url";
import { dirname, resolve } from "path";
import { defineConfig } from "vite";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export default defineConfig({
  base: "./",
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  build: {
    rollupOptions: {
      input: {
        demo1: resolve(__dirname, "index.html"),
        demo2: resolve(__dirname, "index2.html"),
        demo3: resolve(__dirname, "index3.html"),
      },
    },
  },
});
Media credits and license evidence실행 안내·자료
파일 저장

README.md
## License

[MIT](LICENSE)
LICENSE실행 안내·자료
파일 저장

MIT License

Copyright (c) 2009 - 2024 [Codrops](https://tympanus.net/codrops)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Bundled dependency licenses실행 안내·자료
파일 저장

GSAP standard license snapshot
Source: https://gsap.com/community/standard-license/
Retrieved: 2026-09-22T04:22:49.089Z
Original distribution copyright and version headers remain in the runtime code.

Standard "No Charge" GSAP License

 I. DEFINITIONS

 “GSAP License” means the terms and conditions of this GSAP Software License Agreement.

 "GSAP Products" means any Software made available at gsap.com (https://gsap.com) or any successor sites, including but not limited to the GSAP animation library and related plugins, tools, or extensions.

 "Permitted Uses" means the implementation and/or use of GSAP Products on any website, web application, or digital interface by any person or entity (which may include, for clarity, those of companies that compete with Webflow in other areas of business).

 "Prohibited Uses" means any implementation and/or use of GSAP Products in tools that allow users to build visual animations without code that encourages, induces, or materially assists in creating a solution that competes with Webflow’s visual animation building capabilities.

 "Competitive Products" means any software, tool, or service that enables users to create, edit, or manage animations through a visual interface or builder similar to Webflow (https://webflow.com).

 II. GRANT OF LICENSE

 Subject to the terms and conditions of this GSAP License, Webflow grants you a non-exclusive, worldwide license to use, reproduce, display, and implement GSAP Products solely for Permitted Uses.

 III. RESTRICTIONS

 You may not:

 Use any GSAP Products for any Prohibited Uses without prior written consent;

 Reverse engineer any GSAP Products for the purpose of creating Competitive Products;

 Remove or alter any proprietary notices or branding from GSAP Products.

 IV. OWNERSHIP AND INTELLECTUAL PROPERTY

 All intellectual property rights in GSAP Products, including but not limited to copyright, patents, trademarks, and trade secrets, remain the exclusive property of Webflow. This GSAP License does not transfer any ownership rights in GSAP Products to you.

 V. TERMINATION

 Webflow may terminate this GSAP License and revoke your access in its discretion if you fail to comply with any of these terms and conditions. Upon termination, you must cease all use of GSAP Products and destroy all copies in your possession.

 VI. MISCELLANEOUS PROVISIONS

 General: This GSAP License is incorporated into and subject to Webflow’s Terms of Service available here (https://webflow.com/legal/terms) ("Terms of Service"). In the event of any conflict or inconsistency between this GSAP License and the Terms of Service, the terms of this GSAP License shall govern in relation to your use of any GSAP Products.

 Amendments: Webflow reserves the right to update or modify this GSAP License at any time by posting the revised terms on this website, provided that any such updates or modifications shall not result in any material degradation to the security, integrity, or functionality of any GSAP Products. You understand and agree that your continued use of any GSAP Products after such revisions to this GSAP License constitutes your acceptance of this GSAP License as revised. If you do not accept the revised GSAP License, you are prohibited from using versions of the GSAP Products released after the effective date of the revised GSAP License (as well as any updates made to previous versions). Notwithstanding, you may continue using previous versions of GSAP Products under the applicable terms licensed to you prior to the effective date of the revised GSAP License (for clarity, excluding any updates made thereto).

 No Waiver: Failure of Webflow to enforce any provision of this GSAP License shall not constitute a waiver of future enforcement of that or any other provision.

 FAQ

 Is it acceptable for AI tools like ChatGPT, Cursor, Lovable, Webstudio, etc. to generate GSAP code?
 Absolutely! AI-generated code is not a "Prohibited Use".

 What if a WordPress plugin or theme or other niche tool allows users to create GSAP-driven effects through a visual interface? Is that prohibited?
 We want to encourage developers to build on top of GSAP, including visual tools that don't directly compete with Webflow's rich animation-building capabilities. If you are not sure if your product might be considered a "Prohibited Use", feel free to contact us (https://gsap.com/contact) so we can talk through it!

 Can I really use GSAP in commercial projects without paying anything?
 Yes, really! Commercial usage is covered under the standard license. All of GSAP including the plugins that were formerly "members-only" like SplitText (https://gsap.com/docs/v3/Plugins/SplitText/) and MorphSVG (https://gsap.com/docs/v3/Plugins/MorphSVGPlugin) can be used in commercial projects at no charge. Enjoy! 💚

 Effective date: April 30, 2025

 Last modified date: May 30, 2025

 Copyright (©) 2025, Webflow