Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main>
    <div class="frontFace">
        <div class="frontFace-container">
            <div class="frontContent">
                <div class="frontContent-sentence">
                    <div class="frontContent-title">
                        <p class="frontContent-title-main">Salvador<br>Dalí</p>
                        <p class="frontContent-text">
                            Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima
                        </p>
                    </div>
                    <div class="frontContent-img">
                        <img src="https://drive.google.com/uc?export=view&id=1jCQgj9gOKgCdGc8u8mSPa7kXCDwalXVH" alt="" class="img">
                    </div>
                </div>
                <div class="buttonFrame">
                    <button class="button-menu">
                        <div class="button-open">
                            <p class="click">Visit the Work</p>
                        </div>
                    </button>
                </div>
            </div>
        </div>
    </div>
    <div class="backFace">
        <div class="backFace-container">
            <div class="backFace-area">
              <p class="backFace-text">
                  Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.
              </p>
              <div class="buttonFrame close">
                  <button class="button-menu">
                      <div class="button-close">
                          <p class="click">Leave the Work</p>
                      </div>
                  </button>
              </div>
            </div>
            <div class="clock-container" id="container">
                <div class="image-container">
                    <div class="c1">
                        <img class="clock img01" src="https://drive.google.com/uc?export=view&id=1WWozan_0IPGIIQAomC9cko4UO40wGQrD" alt="">
                    </div>
                    <div class="c2">
                        <img class="clock img02" src="https://drive.google.com/uc?export=view&id=1XjZCcdCkm1TwKzw7Mc02nYH2rwiBGFuS" alt="">
                    </div>
                    <div class="c3">
                        <img class="clock img03" src="https://drive.google.com/uc?export=view&id=19Re2CmsxZUUztZeGlKCaPQCLI4-cVDed" alt="">
                    </div>
                </div>
                <div class="c4">
                    <img class="typo img04" src="https://drive.google.com/uc?export=view&id=1kNaJI8nWnKpZSRa86YA6BzokGMrZYTPn" alt="">
                </div>
                <div class="c5">
                    <img class="typo img05" src="https://drive.google.com/uc?export=view&id=1kNaJI8nWnKpZSRa86YA6BzokGMrZYTPn" alt="">
                </div>
            </div>
        </div>
    </div>
    <svg class="overlay" width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="none">
        <path class="overlay-path" vector-effect="non-scaling-stroke" d="M 0 100 V 100 Q 50 100 100 100 V 100 z" />
    </svg>
</main>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <defs>
    <filter id="noise">
      <feTurbulence type="fractalNoise" id="turbulence" baseFrequency="0.002" numOctaves="3" result="noise" seed="0"/>
      <feDisplacementMap id="displacement" in="SourceGraphic" in2="noise" scale="400" />
    </filter>
    <filter id="contrast">
      <feColorMatrix in="SourceGraphic" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 30 -10" result="matrix" />
      <feComposite in="SourceGraphic" in2="matrix" operator="atop"/>
    </filter>
  </defs>
</svg>
              
            
!

CSS

              
                 @import url(https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;500;600;700;800&display=swap);

html {
    filter: url('#contrast');
    height: 100%;
}

::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body {
	margin: 0;
	color: #000;
	font-family: 'Shippori Mincho', serif;
	overflow: hidden;
}

p {
    margin: 0;
}

.frontFace {
    position: relative;
    height: 100vh;
    background-color: #f3f3f3;
    display: flex;
    justify-content: center;
    align-items: center;
}

.frontFace-container::before {
     content: "The\APersistence of\AMemory";
     white-space: pre;
     position: absolute;
     top: 50%;
     left: 0;
     transform: translateY(-50%);
     font-size: 13.375vw;
     letter-spacing: 0.05em;
     color: #edebeb;
     line-height: 1.4;
}

.frontContent-sentence {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 85vw;
    margin: 0 auto;
    position: relative;
    z-index: 0;
}

.frontContent-title {
    width: 47.8125vw;
}

.frontContent-title-main {
    font-weight: 400;
	font-size: 8.75vw;
    letter-spacing: 0.017em;
    line-height: 1;
    margin: 5.125vw auto 3vw;
}

.frontContent-text {
    margin-top: 2vw;
    font-weight: 400;
    text-align: justify;
    font-size: 1.125vw;
    letter-spacing: 0.05em;
    line-height: 2;
}

.frontContent-img {
    width: 34.9375vw;
    margin-top: 6vw;
}

img {
    width: 100%;
    height: auto;
}

.backFace {
	position: relative;
	background: #fff;
	opacity: 0;
    height: 100vh;
    margin-top: -100vh;
}

.backFace-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.backFace-text {
    font-weight: 400;
    text-align: justify;
    font-size: 1vw;
    letter-spacing: 0.1em;
    width: 60vw;
    line-height: 2.5;
}

.clock-container {
    filter:url('#noise') blur(7px);
    position: absolute;
    width: 100%;
    height: 100%;
    overflow-y: hidden;
}

.image-container {
    display: flex;
    justify-content: center;
}

.c1 {
    animation: clock-1 15s infinite;
}

.c2 {
    animation: clock-2 17s infinite;
    margin-left: 5vw;
}

.c3 {
    animation: clock-3 20s infinite;
    margin-left: 5vw;
}

.c4 {
    animation: typo-1 20s infinite;
}

.c5 {
    animation: typo-2 30s infinite;
}

.clock {
    width: 31.875vw;
    height: 29.375vw;
}

img {
    width: 100%;
    height: auto;
}

@keyframes clock-1 {
    0% {
        transform: translateY(200%);
    }
    100% {
        transform: translateY(-100%);
    }
}

@keyframes clock-2 {
    0% {
        transform: translateY(300%);
    }
    100% {
        transform: translateY(-100%);
    }
}

@keyframes clock-3 {
    0% {
        transform: translateY(400%);
    }
    100% {
        transform: translateY(-100%);
    }
}

@keyframes typo-1 {
    0% {
        transform: translateY(200%);
    }
    100% {
        transform: translateY(-200%);
    }
}

@keyframes typo-2 {
    0% {
        transform: translateY(300%);
    }
    100% {
        transform: translateY(-300%);
    }
}

.frontFace--menu-open .button-menu {
	opacity: 0;
	pointer-events: none;
}

.backFace.backFace--open {
	opacity: 1;
    pointer-events: auto;
}

.overlay {
	position: absolute;
    top: 0;
    left: 0;
	z-index: 1000;
	width: 100%;
	height: 100%;
    pointer-events: none;
}

.buttonFrame {
    position: relative;
    z-index: 1;
    margin-top: 1vw;
}

.buttonFrame.close {
    margin-top: 5vw;
}

.button-menu {
    background-color: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    padding: 0;
    appearance: none;
    margin: 0 auto;
    display: block;
    justify-content: center;
    font-family: 'Shippori Mincho', serif;
    height: 5.625vw;
    width: 25vw;
}

.button-open .click,
.button-close .click {
    position: relative;
    line-height: 1;
    font-size: 1.125vw;
    font-weight: 400;
    letter-spacing: 0.4em;
    transition: letter-spacing 0.2s ease-out;
    height: 5.625vw;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.button-open::before,
.button-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5.625vw;
    height: 5.625vw;
    border-radius: 50%;
    transition: width 0.2s ease-out, height 0.2s ease-out;
}

.button-open::before {
    background-color: #fff;
    z-index: -1;
}

.button-close::before {
    background-color: #f3f3f3;
}

.button-menu:hover .button-open .click,
.button-menu:hover .button-close .click {
    letter-spacing: 0.2em;
}

.button-menu:hover .button-open::before,
.button-menu:hover .button-close::before {
    width: 0;
    height: 0;
}


@media screen and (min-width:1600px) {
    .frontFace {
        height: 100vh;
    }

    .frontFace-container::before {
        font-size: 230px;
    }


    .frontContent-sentence {
        width: 1360px;
    }

    .frontContent-title {
        width: 680px;
    }

    .frontContent-title-main {
        font-size: 140px;
        margin: 82px auto 48px;
    }

    .frontContent-text {
        margin-top: 32px;
        font-size: 18px;
    }

    .frontContent-img {
        width: 559px;
        margin-top: 96px;
    }

    .backFace-text {
        font-size: 16px;
        width: 960px;
    }

    .buttonFrame {
        bottom: 48px;
    }

    .button-menu {
        height: 90px;
        width:  400px;
    }

    .button-open .click,
    .button-close .click {
        font-size: 20px;
        height: 90px;
    }

    .button-open::before,
    .button-close::before {
        width: 90px;
        height: 90px;
    }
}

@media screen and (max-width: 1600px) and (max-height: 800px) {
    .buttonFrame {
        margin-top: -4vw;
    }
}
              
            
!

JS

              
                const frame = document.querySelector(".buttonFrame");
const overlayPath = document.querySelector(".overlay-path");
const menuWrap = document.querySelector(".backFace");
const openMenuCtrl = document.querySelector(".button-menu");
const closeMenuCtrl = document.querySelector(".button-close");

// ボタンをクリックした後に走らせるDOM
const hide = {
  main: document.querySelector(".frontContent-title"),
  content: document.querySelector(".frontContent-img"),
  leave: document.querySelector(".backFace-text"),
  clock: document.querySelector(".clock-container"),
};

// ボタンを連打しても違和感がないようにフラグを設ける。
//  openMenuまたはcloseMenuが発火し終わったら発火するようにする。
let isAnimating = false;

// OPENさせた時
const openMenu = () => {
  if (isAnimating) return;
  isAnimating = true;
  gsap
    .timeline({
      onComplete: () => (isAnimating = false),
    })

    // 初めにアニメーションするパス
    // 透明なパス
    .set(overlayPath, {
      attr: { d: "M 0 100 V 100 Q 50 100 100 100 V 100 z" },
    })

    // 扇型を黒く塗りつぶしたパス
    .to(
      overlayPath,
      {
        duration: 0.5,
        ease: "power4.in",
        attr: { d: "M 0 100 V 50 Q 50 0 100 50 V 100 z" },
      },
      0
    )

    // 真っ黒なパス
    .to(overlayPath, {
      duration: 0.3,
      ease: "power2",
      attr: { d: "M 0 100 V 0 Q 50 0 100 0 V 100 z" },
      onComplete: () => {
        frame.classList.add("frontFace--menu-open");
        menuWrap.classList.add("backFace--open");
      },
    })

    // 前面の画像やテキストを上に移動させる。
    .to(
      [hide.main, hide.content, openMenuCtrl],
      {
        duration: 0.5,
        ease: "power3.in",
        y: -200,
        opacity: 0,
        stagger: 0.05,
      },
      0.2
    )

    // 後にアニメーションするパス
    // 真っ黒なパス
    .set(overlayPath, {
      attr: { d: "M 0 0 V 100 Q 50 100 100 100 V 0 z" },
    })

    // 扇型の余白部分を黒く塗りつぶしたパス
    .to(overlayPath, {
      duration: 0.3,
      ease: "power2.in",
      attr: { d: "M 0 0 V 50 Q 50 0 100 50 V 0 z" },
    })

    // 透明なパス
    .to(overlayPath, {
      duration: 0.5,
      ease: "power4",
      attr: { d: "M 0 0 V 0 Q 50 0 100 0 V 0 z" },
    })

    // 後面のテキストと時計を移動させながら表示させる。
    .to(
      [hide.leave, hide.clock],
      {
        duration: 1.1,
        ease: "power4",
        startAt: { y: 150 },
        y: 0,
        opacity: 1,
        stagger: 0.05,
      },
      ">-=1.1"
    );
};

// CLOSEさせた時
const closeMenu = () => {
  if (isAnimating) return;
  isAnimating = true;
  gsap
    .timeline({
      onComplete: () => (isAnimating = false),
    })

    // 初めにアニメーションするパス
    // 透明なパス
    .set(overlayPath, {
      attr: { d: "M 0 0 V 0 Q 50 0 100 0 V 0 z" },
    })

    // 扇型を黒く塗りつぶして反転させたパス
    .to(
      overlayPath,
      {
        duration: 0.5,
        ease: "power4.in",
        attr: { d: "M 0 0 V 50 Q 50 100 100 50 V 0 z" },
      },
      0
    )

    // 真っ黒なパス
    .to(overlayPath, {
      duration: 0.3,
      ease: "power2",
      attr: { d: "M 0 0 V 100 Q 50 100 100 100 V 0 z" },
      onComplete: () => {
        frame.classList.remove("frontFace--menu-open");
        menuWrap.classList.remove("backFace--open");
      },
    })

    // 後にアニメーションするパス
    // 真っ黒なパス
    .set(overlayPath, {
      attr: { d: "M 0 100 V 0 Q 50 0 100 0 V 100 z" },
    })

    // 扇型の余白部分を黒く塗りつぶして反転させたパス
    .to(overlayPath, {
      duration: 0.3,
      ease: "power2.in",
      attr: { d: "M 0 100 V 50 Q 50 100 100 50 V 100 z" },
    })

    // 透明なパス
    .to(overlayPath, {
      duration: 0.5,
      ease: "power4",
      attr: { d: "M 0 100 V 100 Q 50 100 100 100 V 100 z" },
    })

    // 前面の画像やテキストを上に移動させる。
    .to(
      [hide.main, hide.content, openMenuCtrl],
      {
        duration: 1.1,
        ease: "power4",
        y: 0,
        opacity: 1,
        stagger: -0.05,
      },
      ">-=1.1"
    )

    // 後面のテキストと時計を移動させながら表示させる。
    .to(
      [hide.leave, hide.clock],
      {
        duration: 0.8,
        ease: "power2.in",
        y: 100,
        opacity: 0,
        stagger: -0.05,
      },
      0
    );
};

openMenuCtrl.addEventListener("click", openMenu);
closeMenuCtrl.addEventListener("click", closeMenu);

              
            
!
999px

Console