東京LP

東京LP

by prodouga

HTML

<!DOCTYPE html>
<html lang="ja" >
<head>
  <meta charset="UTF-8">
  <title>東京LP - Prodouga.com</title>
  <link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div id="root"></div>
  <small><a href="https://prodouga.com/contact">WEB制作はプロドウガ</a></small>
<!-- partial -->
  <script src='https://unpkg.com/react@17/umd/react.development.js'></script>
<script src='https://unpkg.com/react-dom@17/umd/react-dom.development.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js'></script><script  src="./script.js"></script>

</body>
</html>

CSS

@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&display=swap");
* {
  box-sizing: border-box;
  user-select: none;
}

a {
  color: #fff;
  text-decoration: none;
  font-family: "Nunito Sans", sans-serif;
  transition: color 0.3s, text-shadow 0.3s;
}

a:hover {
  text-shadow: 0 0 10px currentColor;
}

a:nth-child(1):hover {
  color: #e57373;
}

a:nth-child(2):hover {
  color: #81c784;
}

a:nth-child(3):hover {
  color: #64b5f6;
}

a:nth-child(4):hover {
  color: #ffb74d;
}

a:nth-child(5):hover {
  color: #ba68c8;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  color: white;
  background: black;
  font-family: "Inter", sans-serif;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(1rem, 5vw, 5rem);
  font-family: "Playfair Display", serif;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  color: #cccccc;
  width: 90vw;
  max-width: 1200px;
}

h2:hover {
  transform: scale(1.05);
  text-shadow: 0 0 10px #cccccc;
}

header {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  width: 100%;
  z-index: 3;
  height: 7em;
  font-family: "Inter", sans-serif;
  font-size: clamp(0.66rem, 2vw, 1rem);
  letter-spacing: 0.5em;
}

.section {
  height: 100%;
  width: 100%;
  top: 0;
  position: fixed;
  visibility: hidden;
}
.section .wrapper-outer,
.section .wrapper-inner {
  width: 100%;
  height: 100%;
  overflow-y: hidden;
}
.section .background {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  background-size: cover;
  background-position: center;
}
.section .background h2 {
  z-index: 2;
}
.section .background .clip-text {
  overflow: hidden;
}

.first .background {
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%,...

JavaScript

const App = () => {
  React.useEffect(() => {
    let sections = document.querySelectorAll(".section"),
    images = document.querySelectorAll(".background"),
    headings = document.querySelectorAll(".section-title"),
    outerWrappers = document.querySelectorAll(".wrapper-outer"),
    innerWrappers = document.querySelectorAll(".wrapper-inner"),
    currentIndex = -1,
    wrap = (index, max) => (index + max) % max,
    animating;

    gsap.set(outerWrappers, { yPercent: 100 });
    gsap.set(innerWrappers, { yPercent: -100 });

    function gotoSection(index, direction) {
      index = wrap(index, sections.length);
      animating = true;

      let fromTop = direction === -1;
      let dFactor = fromTop ? -1 : 1;
      let tl = gsap.timeline({ defaults: { duration: 1.25, ease: "power1.inOut" }, onComplete: () => animating = false });

      if (currentIndex >= 0) {
        gsap.set(sections[currentIndex], { zIndex: 0 });
        tl.to(images[currentIndex], { yPercent: -15 * dFactor }).
        set(sections[currentIndex], { autoAlpha: 0 });
      }

      gsap.set(sections[index], { autoAlpha: 1, zIndex: 1 });
      tl.fromTo([outerWrappers[index], innerWrappers[index]], { yPercent: i => i ? -100 * dFactor : 100 * dFactor }, { yPercent: 0 }, 0).
      fromTo(images[index], { yPercent: 15 * dFactor }, { yPercent: 0 }, 0).
      fromTo(headings[index], { autoAlpha: 0, yPercent: 150 * dFactor }, {
        autoAlpha: 1,
        yPercent: 0,
        duration: 1,
        ease: "power2",
        stagger: { each: 0.02, from: "random" } },
      0.2);

      currentIndex = index;
    }

    function navigateSectionById(id) {
      let index = Array.from(sections).findIndex(section => section.id === id);

      if (index !== -1 && index !== currentIndex) {
        gotoSection(index, index > currentIndex ? 1 : -1);
      }
    }

    let lastTap = 0;
    document.addEventListener("touchend", function (event) {
      let currentTime = new Date().getTime();
      let...