Codrops 원본

Letter Shuffle Animation for a Menu

탐색 · MIT

탐색 더 보기
ORIGINAL PREVIEW
Letter Shuffle Animation for a Menu 정적 미리보기

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

큰 화면으로 보기 새 탭

SOURCE FILES

원본 코드 읽기

10개 파일

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

src/css/base.css
파일 저장

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

:root {
	font-size: 18px;
}

body {
	margin: 0;
	--color-text: #867a8b;
	--color-text-alt: #9b7749;
	--color-link: #6b4e65;
	--color-link-hover: #9b7749;
	--color-menu: #e3dce5;
	--color-menu-hover: #af449a;
	--color-menu-border: #4c2d4e;
	color: var(--color-text);
	background: linear-gradient(to bottom, #2b192c, #1a191c);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-family: acumin-pro-wide, sans-serif;
	font-weight: 300;
	--size-menu: 6vh;
}

/* Page Loader */
.js .loading::before,
.js .loading::after {
	content: '';
	position: fixed;
	z-index: 10000;
}

.js .loading::before {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(to bottom, #2b192c, #1a191c);
}

.js .loading::after {
	top: 50%;
	left: 50%;
	width: 60px;
	height: 60px;
	margin: -30px 0 0 -30px;
	border-radius: 50%;
	opacity: 0.4;
	background: var(--color-link);
	animation: loaderAnim 0.7s linear infinite alternate forwards;

}

@keyframes loaderAnim {
	to {
		opacity: 1;
		transform: scale3d(0.5,0.5,1);
	}
}

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

a:hover {
	color: var(--color-link-hover);
	outline: none;
}

/* Better focus styles from https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible */
a:focus {
	/* Provide a fallback style for browsers
	 that don't support :focus-visible */
	outline: none;
	background: lightgrey;
}

a:focus:not(:focus-visible) {
	/* Remove the focus indicator on mouse-focus for browsers
	 that do support :focus-visible */
	background: transparent;
}

a:focus-visible {
	background: transparent;
}

.content a:focus-visible,
.frame a:focus-visible {
	/* Draw a very noticeable focus style for
	 keyboard-focus on browsers that do support
	 :focus-visible */
	outline: 2px solid var(--color-link);
	background: transparent;
}

/* Line hover */
.hover-line {
	white-space: nowrap;
	overflow: hidden;
	position: relative;
}

.hover-line::before {
	content: '';
	height: 1px;
	width: 100%;
	background: currentColor;
	position: absolute;
	top: 92%;
	transition: transform 0.3s;
	transform-origin: 0% 50%;
}

.hover-line:hover::before {
	transform: scaleX(0);
	transform-origin: 100% 50%;
}

.unbutton {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
}

.unbutton:focus {
	outline: none;
}

main {
	width: 100%;
	min-height: 100vh;
	display: grid;
	grid-template-columns: 10vw 10vh 10vw 5vw 32vw 1fr;
	grid-template-rows: auto 1fr;
	grid-template-areas: 'side side side frame frame frame'
						'content content content content content content';
}

.no-js main {
	grid-template-areas: 'content content content content content content';
}

.frame {
	position: relative;
	color: var(--color-text-alt);
	grid-area: frame;
	padding: 0.75rem 1.5rem;
	background: #2b192c;
}

.frame a {
	pointer-events: auto;
}

.frame__title {
	font-size: 1rem;
	font-weight: 300;
	margin: 0;
	justify-self: start;
	grid-area: title;
}

.frame__links {
	grid-area: links;
	padding: 0;
	margin: 1rem 0;
	justify-self: end;
}

.frame__links a:not(:last-child) {
	margin-right: 1rem;
}

.content {
	grid-area: content;
	display: grid;
	place-content: center;
	padding: 1rem 5vw;
}

.button-next {
	cursor: not-allowed;
	grid-area: content;
	align-self: center;
	justify-self: end;
	width: 70px;
	height: 140px;
	display: none;
	place-items: center;
	border-radius: 70px 0 0 70px;
	background: linear-gradient(to bottom, #9b498a, #9b7749);
}

.color-alt {
	color: var(--color-text-alt);
}

.menu {
	grid-area: 1 / 1 / 2 / 7;
	display: grid;
	grid-template-columns: 5vw 5vw 11vh 5vw 1fr;
	grid-template-rows: auto 1fr;
	position: relative;
	pointer-events: none;
	z-index: 100;
	border-bottom: 1px solid var(--color-menu-border);
}

.no-js .menu {
	display: none;
}

.menu__bg {
	transform: translateX(-100%) translateX(20vw) translateX(11vh);
	grid-area: 1 / 1 / 3 / 6;
	position: absolute;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(to bottom, #2b192c, #1a191c);
	border-right: 1px solid var(--color-menu-border);
	pointer-events: none;
}

.menu__button {
	margin: 1.25rem;
	position: relative;
	align-self: start;
	cursor: pointer;
	pointer-events: auto;
	grid-area: 1 / 1 / 2 / 3;
	justify-self: start;
}

.menu__button path {
	stroke: var(--color-link);
	fill: none;
}

.menu__button:hover path,
.menu__button:focus-visible path {
	stroke: var(--color-menu-hover);
}

.menu__button-cross {
	opacity: 0;
}

.menu__items {
	grid-area: 2 / 1 / 2 / 6;
	justify-content: start;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	position: relative;
	pointer-events: none;
	margin: 1rem;
	padding-bottom: 1rem;
}

.menu--open .menu__items {
	pointer-events: auto;
}

.menu__item {
	font-family: space-mono, monospace;
	font-weight: 400;
	text-transform: uppercase;
	font-size: var(--size-menu);
	line-height: 0.9;
	color: var(--color-menu);
	position: relative;
	cursor: pointer;
}

.menu__item span {
	pointer-events: none;
}

.menu__item .letter-wrap__inner span:first-child,
.menu__item .letter-wrap__inner span,
.menu__item .letter-wrap span.char {
	transition: color 0.2s ease;
}

.menu--open .menu__item:hover .letter-wrap__inner span:first-child,
.menu--open .menu__item:hover .letter-wrap__inner span,
.menu--open .menu__item:hover .letter-wrap span.char,
.menu--open .menu__item:focus .letter-wrap__inner span:first-child,
.menu--open .menu__item:focus .letter-wrap__inner span,
.menu--open .menu__item:focus .letter-wrap span.char {
	color: var(--color-menu-hover);
}

.menu--open .menu__item:focus-visible {
	outline: 2px solid var(--color-link);
	background: transparent;
}

.menu__item.splitting .word {
	display: flex;
}

.menu__item.splitting .char {
	flex: none;
	display: flex;
	justify-content: center;
	transform-origin: 50% 100%;
	will-change: transform, color;
}

.menu__item .char {
	color: var(--color-link);
}

.letter-wrap,
.letter-wrap__inner span,
.menu__item.splitting .char {
	width: calc(var(--size-menu) * 0.6666);
	display: flex;
	justify-content: center;
	will-change: transform, color;
}

.letter-wrap__inner span:first-child {
	color: var(--color-link);
}

.letter-wrap {
	flex: none;
	height: calc(var(--size-menu) * 0.8833);
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.letter-wrap > span:not(.letter-wrap__inner) {
	opacity: 0;
}

.letter-wrap__inner {
	display: flex;
	flex-direction: column;
	height: fit-content;
}

.menu__tagline {
	display: none;
	font-family: kudryashev-d-excontrast-sans, sans-serif;
	font-weight: 300;
	font-style: normal;
	font-size: 1.75rem;
	grid-area: 1 / 4 / 2 / 5;
	text-transform: none;
	margin: 12.5vh 0 0 1.5vw;
	text-align: right;
	-webkit-writing-mode: vertical-rl;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
}

@media screen and (min-width: 54em) {
	body {
		--size-menu: 15vh;
	}
	main {
		height: 100vh;
		overflow: hidden;
		grid-template-rows: 100%;
		grid-template-areas: 'side side side content content content'
	}

	.menu {
		grid-area: 1 / 1 / 2 / 6;
		grid-template-rows: 100%;
		border: 0;
	}

	.menu__items {
		grid-area: 1 / 3 / 2 / 6;
		justify-content: center;
		margin: 1vh 0 0 0;
		padding-bottom: 0;
	}

	.frame {
		background: none;
		grid-area: content;
		display: grid;
		align-content: space-between;
		pointer-events: none;
		grid-template-columns: 50% 50%;
		grid-template-rows: auto auto auto;
		grid-template-areas: '... sponsor'
						'... arrow'
						'title links';
	}

	.frame::after {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		pointer-events: none;
		width: 100%;
		height: 100%;
		z-index: 10;
		background: linear-gradient(to bottom, #2b192c, #1a191c);
		opacity: 0;
		transition: opacity 1s ease-in-out 0.3s;
	}

	.menu--open ~ .frame::after {
		opacity: 0.8;
		transition-delay: 0s;
		pointer-events: auto;
	}

	.button-next {
		display: grid;
	}
	.menu__tagline {
		display: block;
	}

	.menu__button {
		align-self: center;
		justify-self: center;
		margin: 0;
		grid-area: 1 / 1 / 2 / 2;
	}

	.content {
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 0;
	}

	.content__column {
		max-width: 34ch;
		padding: 0 1.5rem;
	}

	.content__column:first-child {
		margin-top: -10vh;
	}

	.content__column:last-child {
		margin-top: 10vh;
	}

	.frame__links {
		margin: 0;
	}

}
src/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>Letter Shuffle Menu | Codrops</title>
		<meta name="description" content="A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item." />
		<meta name="keywords" content="menu, animation, javascript, letters, typography, css" />
		<meta name="author" content="Codrops" />

		<!-- Facebook Meta Tags -->
		<meta property="og:url" content="https://tympanus.net/Development/LetterShuffleMenu/">
		<meta property="og:type" content="website">
		<meta property="og:title" content="Letter Shuffle Menu | Codrops">
		<meta property="og:description" content="A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item.">
		<meta property="og:image" content="https://tympanus.net/codrops/wp-content/uploads/2022/03/shufflemenu_feat.jpg">

		<!-- Twitter Meta Tags -->
		<meta name="twitter:card" content="summary_large_image">
		<meta property="twitter:domain" content="tympanus.net">
		<meta property="twitter:url" content="https://tympanus.net/Development/LetterShuffleMenu/">
		<meta name="twitter:title" content="Letter Shuffle Menu | Codrops">
		<meta name="twitter:description" content="A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item.">
		<meta name="twitter:image" content="https://tympanus.net/codrops/wp-content/uploads/2022/03/shufflemenu_feat.jpg">
      
		<link rel="shortcut icon" href="favicon.ico">
		<link rel="stylesheet" href="https://use.typekit.net/zhn4ifz.css">
		<link rel="stylesheet" type="text/css" href="css/base.css" />
		<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script>
		<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
		<script src="//tympanus.net/codrops/adpacks/analytics.js"></script>
	</head>
	<body class="loading">
		<main>
			<nav class="menu">
				<div class="menu__bg"></div>
				<button class="menu__button unbutton" aria-label="Toggle menu">
					<svg width="22" height="23" viewBox="0 0 22 23">
						<path class="menu__button-lines" d="M0 3h22M0 11h22M0 19h22"/>
						<path class="menu__button-cross" d="M19.64.359 2.36 22.641m17.28 0L2.36.359"/>
					</svg>
				</button>
				<div class="menu__items">
					<a data-splitting href="#" class="menu__item">About</a>
					<a data-splitting href="#" class="menu__item">Novels</a>
					<a data-splitting href="#" class="menu__item">Memoirs</a>
					<a data-splitting href="#" class="menu__item">Legacy</a>
					<a data-splitting href="#" class="menu__item">Gallery</a>
					<a data-splitting href="#" class="menu__item">Contact</a>
				</div>
				<h3 class="menu__tagline">Literature &amp; Japan</h3>
			</nav>	
			<div class="frame">
				<h1 class="frame__title">Letter Shuffle Menu</h1>
				<nav class="frame__links">
					<a class="hover-line" href="http://tympanus.net/Development/ExpandingRoundedMenu/">Previous demo</a>
					<a class="hover-line" href="https://tympanus.net/codrops/?p=59837">Article</a>
					<a class="hover-line" href="https://github.com/codrops/LetterShuffleMenu">GitHub</a>
				</nav>
			</div>
			<div class="content">
				<div class="content__column">
					<p>I began trying to make my confession to Buddha; but tears choked me and <a href="#" class="hover-line">my voice</a> fell to a whisper. It was now quite dark. I went to the window and looked out. The Chapel stood high, and below it was what seemed like a precipitous <a href="#" class="hover-line">ravine</a>; it lay in a cup or hollow and the steep banks on either side were overgrown with tall trees, so that the place was very closed-in and dark.</p>
				</div>
				<div class="content__column">
					<p>The moon was some twenty days old and having risen late in the night was now <a href="#" class="hover-line">shining</a> with extraordinary brilliance. Here and there the moonlight pierced through the trees, making sudden patches of brightness; there was one such just at the foot of the cliff. Looking straight below me I could see what appeared to be a vast lake, but was indeed only a small drinking-pool. </p>
					<p class="color-alt">Murasaki, The Sacred Tree</p>
				</div>
			</div>
			<button class="button-next unbutton">
				<svg width="24px" height="12px" viewBox="0 0 24 12"><path d="M18.972.225c-.3-.3-.781-.3-1.081 0-.3.3-.3.782 0 1.082l3.495 3.496H.763A.762.762 0 0 0 0 5.565c0 .426.344.77.763.77H21.38L17.884 9.83c-.3.3-.3.782 0 1.082.15.15.344.225.544.225.2 0 .394-.075.544-.225l4.803-4.803a.766.766 0 0 0 0-1.088L18.972.225Z" fill="#4c2d4e"/></svg>
			</button>
		</main>
		<script src="https://tympanus.net/codrops/adpacks/cda_sponsor.js"></script>
		<script type="module" src="js/index.js"></script>
	</body>
</html>
함께 쓰는 파일 8개 보기
src/js/index.js
파일 저장

import { preloadFonts } from './utils';
import { Menu } from './menu';

// Initialize Menu instance
new Menu(document.querySelector('.menu'));
// Preloading webkit font
preloadFonts('zhn4ifz').then(() => document.body.classList.remove('loading'));
src/js/menu.js
파일 저장

import { gsap } from 'gsap';
import "splitting/dist/splitting.css";
import "splitting/dist/splitting-cells.css";
import Splitting from 'splitting';
import { menuConfig } from './menuConfig';
import { MenuItem } from './menuItem';

// initialize Splitting
Splitting();

/**
 * Class representing the menu element (.menu)
 */
 export class Menu {
    // DOM elements
    DOM = {
        // Main element (.menu)
        el: null,
        // Menu items (.menu__item)
        items: null,
        // Menu button control
        menuCtrl: {
            el: null,
            lines: null,
            cross: null
        },
        // (.menu__bg)
        bg: null,
        // (.menu__tagline)
        tagline: null,
    }
    // The Menu Items instances array
    menuItems = [];
    // Checks if the menu is open or is currently animating
    menuStatus = {
        isOpen: false,
        isAnimating: false
    };
    
    /**
     * Constructor.
     * @param {Element} DOM_el - the .menu element
     */
    constructor(DOM_el) {
        this.DOM = {el: DOM_el};
        this.DOM.items = [...this.DOM.el.querySelectorAll('.menu__item')];
        this.DOM.menuCtrl = {el: this.DOM.el.querySelector('.menu__button')};
        this.DOM.menuCtrl.lines = this.DOM.menuCtrl.el.querySelector('path.menu__button-lines')
        this.DOM.menuCtrl.cross = this.DOM.menuCtrl.el.querySelector('path.menu__button-cross')
        this.DOM.bg = this.DOM.el.querySelector('.menu__bg');
        this.DOM.tagline = this.DOM.el.querySelector('.menu__tagline');

        // Create the MenuItem instances
        this.DOM.items.forEach(item => this.menuItems.push(new MenuItem(item)));

        this.initEvents();
    }
    /**
     * Initializes some events.
     */
    initEvents() {
        this.DOM.menuCtrl.el.addEventListener('click', () => {
            if ( this.menuStatus.isAnimating ) return;

            if ( !this.menuStatus.isOpen ) {
                this.open();
            }
            else {
                this.close();
            }
        });
    }
    /**
     * Opens the menu
     */
    open() {
        if ( this.menuStatus.isAnimating || this.menuStatus.isOpen ) return;
        this.menuStatus.isAnimating = true;
        this.menuStatus.isOpen = true;
        
        const gradient = {value: 'linear-gradient(to bottom, #2b192c, #1a191c)'};

        this.menuTimeline = gsap.timeline({
            defaults: {
                duration: 1.7,
                ease: 'expo.inOut'
            },
            onComplete: () => this.menuStatus.isAnimating = false
        })
        .addLabel('start', 0)
        .add(() => {
            this.DOM.el.classList.add('menu--open');
        }, 'start')
        .to(this.DOM.bg, {
            startAt: {x: -1*this.DOM.bg.offsetWidth + .2*window.innerWidth + .11*window.innerHeight},
            x: 0
        }, 'start')
        .to(gradient, {
            value: 'linear-gradient(rgb(68, 37, 61), rgb(29 24 39))',
            //value: 'linear-gradient(to bottom, #9b498a, #9b7749)',
            onUpdate: () => this.DOM.bg.style.backgroundImage = gradient.value
        }, 'start')
        .to(this.DOM.tagline, {
            opacity: 0,
            x: '-50%'
        }, 'start')
        .to(this.DOM.menuCtrl.cross, {
            duration: 0.5,
            ease: 'power2.inOut',
            opacity: 1
        }, 'start')
        .to(this.DOM.menuCtrl.lines, {
            duration: 0.5,
            ease: 'power2.inOut',
            opacity: 0
        }, 'start')
        .to(this.menuItems.map(item => item.DOM.slotMachine), {
            //ease: 'power3.inOut',
            y: `${100/menuConfig.slotMachineTotalLetters*(menuConfig.slotMachineTotalLetters-1)}%`,
            stagger: 0.03
        }, 'start')

        this.menuItems.forEach(item => {
            this.menuTimeline.to(item.DOM.chars, {
                startAt: {x: '100%', rotation: 10, opacity: 1},
                x: '0%',
                opacity: 1,
                rotation: 0,
                stagger: 0.04
            }, 'start');
        });
    }
    /**
     * Closes the menu
     */
    close() {
        if ( this.menuStatus.isAnimating || !this.menuStatus.isOpen ) return;
        this.menuStatus.isAnimating = true;
        this.menuStatus.isOpen = false;

        const gradient = {value: 'linear-gradient(rgb(68, 37, 61), rgb(29 24 39))'};
        
        this.menuTimeline = gsap.timeline({
            defaults: {
                duration: 1.3,
                ease: 'expo.inOut'
            },
            onComplete: () => this.menuStatus.isAnimating = false
        })
        .addLabel('start', 0)
        .add(() => {
            this.DOM.el.classList.remove('menu--open');
        }, 'start')
        .to(this.DOM.menuCtrl.cross, {
            duration: 0.5,
            ease: 'power2.inOut',
            opacity: 0
        }, 'start')
        .to(this.DOM.menuCtrl.lines, {
            duration: 0.5,
            ease: 'power2.inOut',
            opacity: 1
        }, 'start')
        .to(this.menuItems.map(item => item.DOM.slotMachine), {
            duration: 1.5,
            y: '0%',
            stagger: -0.01
        }, 'start')

        this.menuItems.forEach(item => {
            this.menuTimeline.to(item.DOM.chars, {
                x: '100%', 
                rotation: 10, 
                stagger: -0.04
            }, 'start');
        });

        this.menuTimeline
        .to(this.DOM.bg, {
            x: -1*this.DOM.bg.offsetWidth + .2*window.innerWidth + .11*window.innerHeight,
            onComplete: () => {
                this.DOM.bg.style.transform = 'translateX(-100%) translateX(20vw) translateX(11vh)';
            }
        }, 'start+=0.2')
        .to(gradient, {
            value: 'linear-gradient(to bottom, #2b192c, #1a191c)',
            onUpdate: () => this.DOM.bg.style.backgroundImage = gradient.value
        }, 'start+=0.2')
        .to(this.DOM.tagline, {
            opacity: 1,
            x: '0%'
        }, 'start+=0.2')
    }
 }
src/js/menuConfig.js
파일 저장

/**
 * exports some default options.
 */
 export let menuConfig = {
    slotMachineTotalLetters: 8,
    displayVerticalTitle: 'HAPUKU'
};
src/js/menuItem.js
파일 저장

import { menuConfig } from './menuConfig';

/**
 * Class representing the menu item (.menu__item)
 */
 export class MenuItem {
    // DOM elements
    DOM = {
        // Main element (.menu__item)
        el: null,
        // The span.char created by calling Splitting
        chars: null,
        // the element that stores all the vertical letters (.letter-wrap__inner) and that will animate up/down before revealing the menu item tex
        slotMachine: null,
    }
    // The position of this item in the menu
    itemPosition;
    
    /**
     * Constructor.
     * @param {Element} DOM_el - the .menu__item element
     */
    constructor(DOM_el) {
        this.DOM = {el: DOM_el};
        this.DOM.chars = [...this.DOM.el.querySelectorAll('span.char')];
        this.itemPosition = [...this.DOM.el.parentNode.children].indexOf(this.DOM.el);

        // Creates the necessary DOM elements to store all the letters and the extra random letters for the slot machine effect
        this.layout();
    }
    /**
     * This DOM modification will happen for every menu item e.g. <a data-splitting href="#" class="menu__item">ABOUT</a>
     * 
     * The a.menu__item will get transformed into:
     * 
     * <a href="#" class="menu__item">
     *   <span class="letter-wrap">
     *     <span class="letter-wrap__inner">
     *       <span>A</span> // first letter in "ABOUT"
     *       <span>H</span> // random letter
     *       <span>W</span> // random letter
     *       <span>P</span> // random letter
     *       ...            // random letters
     *       <span>P</span> // first letter in "HAPUKU"
     *     </span>
     *   </span>
     *   <span class="letter-wrap"><span>B</span></span>
     *   <span class="letter-wrap"><span>O</span></span>
     *   <span class="letter-wrap"><span>U</span></span>
     *   <span class="letter-wrap"><span>T</span></span>
     * </a>
     */
    layout() {
        // We need slotMachineTotalLetters-2 random letters. 
        // The first span inside the .letter-wrap__inner is the first letter in the original link name 
        // The last span inside the .letter-wrap__inner is the nth letter (this menu item'position) in the menuConfig.displayVerticalTitle 
        const totalRandomChars = menuConfig.slotMachineTotalLetters-2;
        const allChars = 'ABCDEFGHIJKLMNOPRSTUVWXYZ';
        
        this.DOM.chars.forEach((char, charPosition) => {
            const wrapEl = document.createElement('span');
            wrapEl.classList = 'letter-wrap';
            char.parentNode.appendChild(wrapEl);
            wrapEl.appendChild(char);
            
            // First char needs a vertical structure (slot machine)
            if ( charPosition === 0 ) {
                this.DOM.slotMachine = document.createElement('span');
                this.DOM.slotMachine.classList = 'letter-wrap__inner';
                wrapEl.appendChild(this.DOM.slotMachine);
                
                const randomCharsArray = Array.from({ length: totalRandomChars }, _ => allChars.charAt(Math.floor(Math.random() * allChars.length)));
                let htmlStr = `<span>${char.innerHTML}</span>`;
                for (let i = 0; i <= totalRandomChars-1; ++i ) {
                    htmlStr += i === totalRandomChars-1 ? `<span>${randomCharsArray[i]}</span><span>${menuConfig.displayVerticalTitle.charAt(this.itemPosition)}</span>` : `<span>${randomCharsArray[i]}</span>`
                };
                this.DOM.slotMachine.innerHTML = htmlStr;
                wrapEl.removeChild(char);
            }
        });
    }
 }
src/js/utils.js
파일 저장

// Preload images
const preloadFonts = id => {
    return new Promise((resolve) => {
        WebFont.load({
            typekit: {
                id: id
            },
            active: resolve
        });
    });
};

export {
    preloadFonts
};
Media credits and license evidence실행 안내·자료
파일 저장

README.md
## Credits

- Images from [Unsplash](https://unsplash.com/)


## License
[MIT](LICENSE)

Made with :blue_heart:  by [Codrops](http://www.codrops.com)
LICENSE실행 안내·자료
파일 저장

MIT License

Copyright (c) 2009 - 2021 [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


splitting@1.1.0 — LICENSE.md
MIT License

Copyright (c) 2018 Stephen Shaw

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.