GSAP 원본
Rolling text
텍스트 · MIT (public Pen panels); GSAP Standard No Charge License
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
vendor/gsap-previews/sources/gsap-d3d10bd07528/index.html
<div class="container">
<div class="tube">
<h1 class="line line1">SplitText</h1>
<h1 class="line line2">SplitText</h1>
<h1 class="line line3">SplitText</h1>
<h1 class="line line3">SplitText</h1>
</div>
</div>vendor/gsap-previews/sources/gsap-d3d10bd07528/style.css
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body,
html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
.container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
visibility: hidden;
}
.tube {
position: relative;
width: 100%;
height: 24vw;
}
.line {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
line-height: 1;
margin: 0;
letter-spacing: -0.6vw;
font-size: 18vw;
white-space: nowrap;
text-align: center;
}
.line div {
backface-visibility: hidden;
}함께 쓰는 파일 4개 보기
vendor/gsap-previews/sources/gsap-d3d10bd07528/script.js
// original - https://codepen.io/petebarr/pen/oJvVpw
gsap.registerPlugin(SplitText);
console.clear();
// Make container visible
const container = document.querySelector(".container");
gsap.set(container, { visibility: "visible" });
// Grab all lines
const lines = document.querySelectorAll(".line");
// Split characters for all lines
const splitLines = Array.from(lines).map(line =>
new SplitText(line, { type: "chars", charsClass: "char" })
);
// 3D setup
const width = window.innerWidth;
const height = window.innerHeight;
const depth = -width / 8;
const transformOrigin = `50% 50% ${depth}`;
gsap.set(lines, { perspective: 700, transformStyle: "preserve-3d" });
// Timeline animation
const animTime = 0.9;
const tl = gsap.timeline({repeat: -1});
// Animate each line in a loop
splitLines.forEach((split, index) => {
tl.fromTo(
split.chars,
{ rotationX: -90 },
{ rotationX: 90, stagger: 0.08, duration: animTime, ease: "none", transformOrigin },
index * 0.45 // stagger between lines
);
});
vendor/gsap-previews/sources/gsap-d3d10bd07528/adapters/host.css실행 안내·자료
/* StyleGallery host styles: independent replacement for unavailable shared Pen CSS. */
:root{--color-just-black:#111522;--color-surface-white:#f7f3ec;--color-surface75:#cfccc6;--color-surface50:#898e9f;--color-surface25:#414859;--color-shockingly-green:#95efd2;--color-lt-green:#b5f4da;--color-pink:#fbadce;--color-purple:#897dff;--color-lilac:#b5a1ff;--color-orangey:#ffd28c;--color-blue:#75d8ed;--color-ui-gradient:linear-gradient(135deg,#fbadce,#897dff);--light:#f7f3ec;--dark:#111522;--mid:#898e9f}
*{box-sizing:border-box}body{background:#111522;color:#f7f3ec;font-family:system-ui,sans-serif;margin:0;min-height:100vh;width:100%}button,input{font:inherit}button,.button{background:#111522;border:1px solid #898e9f;border-radius:.55rem;color:#f7f3ec;cursor:pointer;padding:.65rem 1rem}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #95efd2;outline-offset:4px}h1,h2,h3,h4{line-height:1.15}h4{font-weight:500}code{font-family:ui-monospace,monospace}.heading-l{font-size:clamp(2rem,6vw,5rem)}.heading-text{font-size:clamp(1.5rem,4vw,3rem)}.box{background:#95efd2;border-radius:14px;height:clamp(38px,12vw,80px);width:clamp(38px,12vw,80px)}.green{background:#95efd2}.purple{background:#897dff}.orange{background:#ffd28c}.gradient-pink{background:linear-gradient(140deg,#fbadce,#fc7f8e)}.gradient-purple{background:linear-gradient(140deg,#b5a1ff,#537ff7)}.center{align-items:center;display:flex;justify-content:center}.text-center{text-align:center}.panel{min-height:100vh;width:100%}.flair:not(img){background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDgiIGhlaWdodD0iMjQ4IiB2aWV3Qm94PSIwIDAgMjQ4IDI0OCI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnIiB4Mj0iMSIgeTI9IjEiPjxzdG9wIHN0b3AtY29sb3I9IiNiNWExZmYiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM3NWQ4ZWQiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJ1cmwoI2cpIj48cGF0aCBkPSJNODcgMjBoNzR2NjdoNjd2NzRoLTY3djY3SDg3di02N0gyMFY4N2g2N1oiLz48L2c+PC9zdmc+");background-position:center;background-repeat:no-repeat;background-size:contain;height:80px;width:80px}.flair--3:not(img){background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDgiIGhlaWdodD0iMjQ4IiB2aWV3Qm94PSIwIDAgMjQ4IDI0OCI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnIiB4Mj0iMSIgeTI9IjEiPjxzdG9wIHN0b3AtY29sb3I9IiM5NWVmZDIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM1MzdmZjciLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJ1cmwoI2cpIj48Y2lyY2xlIGN4PSIxMjQiIGN5PSIxMjQiIHI9Ijg4IiBmaWxsPSJub25lIiBzdHJva2U9InVybCgjZykiIHN0cm9rZS13aWR0aD0iNDgiLz48Y2lyY2xlIGN4PSIxODMiIGN5PSI2MCIgcj0iMjMiIGZpbGw9IiNmNmYzZWIiLz48L2c+PC9zdmc+")}.braces{font-size:1rem}img{max-width:100%}
/* External font programs are omitted; preserve readable fallback typography. */
body,button,input,h1,h2,h3,h4,p,span,div{font-family:inherit}body{font-family:system-ui,sans-serif}code,pre{font-family:ui-monospace,monospace}
vendor/gsap-previews/sources/gsap-d3d10bd07528/adapters/script.js실행 안내·자료
window.__STYLEGALLERY_ASSETS__={};
gsap.registerPlugin(SplitText);
console.clear();
const container = document.querySelector(".container");
gsap.set(container, { visibility: "visible" });
const lines = document.querySelectorAll(".line");
const splitLines = Array.from(lines).map(
(line) => new SplitText(line, { type: "chars", charsClass: "char" })
);
const width = window.innerWidth;
const height = window.innerHeight;
const depth = -width / 8;
const transformOrigin = `50% 50% ${depth}`;
gsap.set(lines, { perspective: 700, transformStyle: "preserve-3d" });
const animTime = 0.9;
const tl = gsap.timeline({ repeat: -1 });
splitLines.forEach((split, index) => {
tl.fromTo(
split.chars,
{ rotationX: -90 },
{ rotationX: 90, stagger: 0.08, duration: animTime, ease: "none", transformOrigin },
index * 0.45
// stagger between lines
);
});
LICENSE실행 안내·자료
<!--
Copyright (c) 2025 - GreenSock - https://codepen.io/GreenSock/pen/dPMjJWv
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.
-->
GSAP 3.15.0
Copyright 2026, GreenSock. All rights reserved.
Subject to the Standard No Charge License: https://gsap.com/standard-license.
The full notice in each original GSAP library file is preserved.
StyleGallery host adapter and replacement SVG subjects: locally authored.
BEHIND THE EXAMPLE
이 장면을 만드는 원리
회전 표현과 중복된 읽기 내용
효과를 제거해도 핵심 내용을 읽을 수 있어야 하며 시각 효과가 읽기 구조를 대신하지 않습니다.
- 이 예제에서는
- 네 h1을 각각 SplitText로 분해하고 폭의 -1/8 깊이를 transformOrigin에 넣습니다. 타임라인의 각 줄은 0.45초 차이로 -90→90도 회전합니다. 폭과 깊이는 초기 한 번만 읽고 네 중복 문장을 보조 기술에서 숨기는 처리는 없습니다.
코드와 함께 확인하기
코드에서 찾기
const depth = -width / 8script.js회전 깊이를 초기 window 폭에서 정합니다.
splitLines.forEachscript.js네 줄의 글자 회전을 서로 겹치는 시점에 배치합니다.
<h1 class="line line1"index.html같은 문장 네 개가 실제 DOM에 존재합니다.
직접 해보기
효과를 멈춘 상태의 DOM 읽기 순서를 확인합니다.
살펴볼 변화시각적으로 한 문장처럼 보여도 중복 제목이 남는다는 차이를 확인합니다.
실행 중 폭을 바꾼 경우와 바꾼 뒤 재시작한 경우를 비교합니다.
살펴볼 변화원본은 resize에 깊이를 재계산하지 않는다는 한계를 확인합니다.
