Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <body>

  <div class="main-container">

    <section class="title-list">

      <div class="container">
        <div class="text-holder one">
          <div class="box" id="button_1">
            <span class="menu_lottie" href="">
              Title one
            </span>
          </div>
        </div>

        <div class="text-holder two">
          <div class="box2" id="button_2">
            <span class="menu_lottie" href="">
              Title two
            </span>
          </div>
        </div>

        <div class="text-holder three">
          <div class="box3" id="button_3">
            <span class="menu_lottie" href="">
              Title three
            </span>
          </div>
        </div>

    </section>

    <section class="articles">
      <div class="title_container">
        <div class="title_holder">
        </div>
      </div>
      <div class="article__text_1">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec commodo ex vitae eleifend vestibulum. Nulla pretium mollis gravida. Nulla non nisi nisl. Pellentesque fermentum eros nec nulla posuere, sed hendrerit lectus pharetra. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nec hendrerit ligula, sed elementum dui. </p>
        <p>Phasellus ut magna condimentum, faucibus felis vitae, viverra mi. Aenean dictum auctor finibus. Sed sollicitudin in nulla et vestibulum. Vestibulum sagittis mauris eu nisi luctus eleifend. Mauris sapien massa, venenatis eu sapien vel, dignissim rutrum justo. Donec eu nibh tincidunt, venenatis velit quis, vestibulum arcu. Phasellus sit amet erat posuere libero dictum sodales. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras dignissim molestie tellus, viverra consequat orci tempus quis.</p>
        <button class="ss_unbutton ss_preview__back" id="back_button"><svg width="100px" height="18px" viewBox="0 0 50 9">
            <path vector-effect="non-scaling-stroke" d="m0 4.5 5-3m-5 3 5 3m45-3h-77"></path>
          </svg></button>
    </section>

  </div>

</body>
              
            
!

CSS

              
                @font-face {
  font-family: "Aeonik";
  src: url("https://assets.website-files.com/638e3cc6a18ee8722ccbd9a5/638e3e2428219509205ae974_Aeonik.otf")
    format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
body {
  margin: 0;
}

.main-container {
  height: 100vh;
  width: 100vw;
  position: relative;
}

.title-list {
  position: absolute;
  z-index: 9999;
}

.articles {
  position: absolute;
  height: 100vh;
  display: grid;
  width: 100vw;
  font-size: 4rem;
  font-family: "Aeonik";
  /*   background: coral; */
}

.title_container {
  height: 100px;
  /*   background: red; */
}

.title_holder {
  text-align: center;
  font-size: 5rem;
}

.text-holder {
  /*   background: blue; */
  display: flex;
  align-items: center;
  padding-left: 3vw;
  height: 40px;
  box-spacing: border-box;
}

/* .one {
  background: aquamarine;
} */
/*
.two {
  background: coral;
}

.three {
  background: aqua;
} */

.article__text_1 {
  padding: 0 1rem;
  line-height: 1.2;
  margin: 0 auto;
  max-width: 65ch;
  font-size: 1rem;
  will-change: transform;
  opacity: 0;
}
.article__text_1 p {
  font-family: "Aeonik";
  /*   margin: 1.5rem 0; */
}

.box,
.box2,
.box3 {
  /*   width: 200px; */
  /*   height: 20vh; */
  font-family: "Aeonik";
  color: #1a1a1a;
  /*   position: absolute; */
  display: flex;
  align-items: center;
  justify-content: center;
}

#button_1 {
  /*   margin-top: 20vh; */
}

/* .menu_clickable {
  pointer-events: all;
} */

.container {
  display: grid;
  margin-top: 30vh;
  width: 10vw;
  height: 25vh;
  font-size: 1vw;
}

#button_1 {
  cursor: pointer;
}

.ss_preview__back {
  margin: auto;
  width: 100%;
  stroke: #1a1a1a;
  cursor: pointer;
  fill: none;
  /*   grid-area: 3 / 1 / 4 / 2; */
  justify-self: center;
  align-self: end;
}

.ss_unbutton {
  background: none;
  border: 0;
  padding-top: 5vh;
  margin: 0;
  font: inherit;
}

.ss_unbutton:focus {
  outline: none;
}

              
            
!

JS

              
                gsap.registerPlugin(Flip);

const title = document.querySelector(".title_holder");
const box = document.querySelector(".box");
const button = document.querySelector("#button_1");
let isAnimating = false;
let isTitleHolder = true;
const container = document.querySelector(".container");
const one = document.querySelector(".one");

button.addEventListener("click", function () {
  tlLoader.play();
  flipMove();
});

function flipMove() {
  const state = Flip.getState(box, { props: "fontSize,lineHeight" });
  title.appendChild(box);
  Flip.from(state, {
    duration: 2,
    ease: "power3.out",
    scale: true
    // }).eventCallback("onComplete", function () {
    //   isAnimatingButton = false;
  });
}

let tlLoader = gsap.timeline({
  paused: true
});

// tlLoader.add(flipMove);
tlLoader.to(
  ".article__text_1",
  {
    opacity: "100%",
    duration: 2,
    ease: "power3.out"
  },
  1
);

tlLoader.to(
  ".box2",
  {
    x: -200,
    autoAlpha: 0,
    duration: 2,
    ease: "power3.out"
  },
  0
);

tlLoader.to(
  ".box3",
  {
    x: 200,
    autoAlpha: 0,
    duration: 2,
    ease: "power3.out"
  },
  0
);

const back_button = document.getElementById("back_button");

back_button.addEventListener("click", function () {
  let tlLoaderReverse = gsap.timeline();
  tlLoaderReverse.add(tlLoader.reverse());
  tlLoaderReverse.add(flipMove2());
});

function flipMove2() {
  const state = Flip.getState(box, { props: "fontSize,lineHeight" });
  one.appendChild(box); // Move the box back to the container
  Flip.from(state, {
    duration: 1.5,
    ease: "power3.out"
    // absolute: true,
    // scale: true
    // }).eventCallback("onComplete", function () {
    //   isAnimatingBackButton = false;
  });
}

              
            
!
999px

Console