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

              
                 <div id="main" class='toucan'>
   <div id='repeat'><i class="fas fa-redo-alt"></i></div>
   <div id='other-work-container' :data-show="(show_menu) ? 'true' : 'false'">
     <div class='menu-icon' @click='show_menu = !show_menu'>
       <span></span>
       <span></span>
       <span></span>
     </div>
     <div class='menu-bg'></div>
     <div class='title'>Other Pens</div>
     <div class='work-list'>
       <a target='blank' :href='w.link' v-for='(w, i) in works' :key="i" :style="{'--i': i + 1}" :class="{show: show_menu == true}">{{w.name}}</a>
     </div>
   </div>
   <div id='wrapper'>
     <div class='first-qtr'></div>
     <div class="second-qtr"></div>
     <div class="third-qtr"> </div>
     <div class="fourth-qtr"> </div>
   </div>

   <div id='inner-wrapper'>
     <div class="part tail1"></div>
     <div class="part tail2"></div>
     <div class="part wing"></div>
     <div class="part sun"></div>
     <div class="part fox-ears">
       <span></span><span></span>
     </div>
     <div class="part fox-head">
       <div class="head"></div>
       <div class="eyes"><span></span><span></span></div>
     </div>

     <div class="part toucan-beak">
       <div class="beak-inner"></div>
     </div>
     <div class="part body">
       <div class="whale-eye"></div>
       <div class="eye">
         <span></span>
       </div>
       <div class="part head">
       </div>
     </div>
   </div>
 </div>
              
            
!

CSS

              
                body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

:root {
  --duration: 1s;
  --ease: ease-in-out;
  --transition: all var(--duration) var(--ease);
  --blue: #7aded8;
  --yellow: #ffdb63;
  --red: #f2718c;
  --purple: #423e58;
}

#repeat {
  z-index: 10;
  position: fixed;
  bottom: 3%;
  right: 3%;
  font-size: 3rem;
  color: var(--purple);
  padding: 0.3em;
  border-radius: 0.2em;
  cursor: pointer;
  transition: all 0.3s;
  opacity: 0;

  &.show {
    opacity: 1;
  }

  &:hover {
    background-color: rgba(255, 255, 255, 0.3);
  }
}

#wrapper {
  width: 100%;
  height: 100%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  position: absolute;
  transition: var(--transition);

  > div {
    position: absolute;
    transition: var(--transition);
  }

  .first-qtr {
    background-color: var(--blue);
    bottom: 50%;
    right: 50%;
    top: -100%;
    left: -100%;
  }

  .second-qtr {
    background-color: #f7e4d8;
    left: 50%;
    right: -100%;
    bottom: 50%;
    top: -100%;
  }

  .third-qtr {
    background-color: #4dc0ca;
    top: 50%;
    bottom: -100%;
    left: -100%;
    right: 50%;
  }

  .fourth-qtr {
    background-color: #f67690;
    top: 50%;
    left: 50%;
    right: -100%;
    bottom: -100%;
  }
}

#inner-wrapper {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: var(--transition);
}

#main {
  height: 100vh;
  width: 100vw;
  position: fixed;

  &.toucan {
    #wrapper {
      .third-qtr,
      .fourth-qtr {
        top: calc(30% + 7rem);
        transition: all calc(var(--duration) / 2) var(--ease);
      }
    }
  }

  &.whale {
    #wrapper {
      transform: translate(-50%, -50%) rotate(270deg);

      .third-qtr,
      .fourth-qtr {
        top: 50%;
      }
    }

    #inner-wrapper {
      --whale-body-width: 30rem;
      transform: translate(-50%, -50%) rotate(270deg);

      .body {
        border-radius: 100% 0% 0% 100% / 40% 20% 20% 40%;
        height: var(--whale-body-width);
        top: 50%;
        transform: translateY(-50%);

        .head {
          right: calc(var(--whale-body-width) * 0.1);
          height: calc(
            var(--whale-body-width) / 2 - 4rem
          ); // half whale body width minus wing
        }
      }

      .sun::before {
        right: 50%;
      }

      .wing::before {
        right: calc(var(--whale-body-width) * 0.1);
        transform: translateX(0);
      }

      .eye {
        top: 100%;

        span {
          top: -50%;
        }
      }

      .toucan-beak {
        top: calc(50% - 7rem);

        .beak-inner {
          top: 100%;
        }
      }

      .tail1 {
        top: calc(50% + var(--whale-body-width) / 2);
        height: 10rem;
        width: 4rem;
        background-color: var(--yellow);
      }

      .tail2 {
        &::before {
          bottom: 0;
        }
      }
    }
  }

  &.fox {
    #wrapper {
      transform: translate(-50%, -50%) rotate(540deg);

      .second-qtr {
        bottom: calc(50% - 10rem);
        transition: all calc(var(--duration) / 2) var(--ease);
      }

      .fourth-qtr {
        top: calc(50% + 10rem);
        bottom: -100%;
        right: -100%;
        left: calc(50% - 10rem);
        transition: all calc(var(--duration) / 2) var(--ease);
      }
    }

    #inner-wrapper {
      transform: translate(-50%, -50%) rotate(540deg) !important;

      .fox-head {
        transform: rotate(45deg) scale(1);

        .eyes {
          span {
            top: 32%;
            left: 7%;

            &:nth-child(2) {
              top: 7%;
              left: 32%;
            }
          }
        }
      }

      .fox-ears span {
        top: 0;
      }

      .sun {
        height: 10rem;
        width: 15rem;
        transition: var(--transition);

        &::before {
          border-radius: 100% 0% 75% 0% / 0% 0% 100% 100% !important;
          right: 0 !important;
          transition: var(--transition);
        }
      }

      .body {
        height: 20rem !important;
        width: 20rem;
        border-radius: 50% 0% 0% 50% / 50% 50% 50% 50% !important;
        background-color: var(--yellow);
        transition: all calc(var(--duration) / 2) var(--ease);

        .head {
          right: 0 !important;
          top: 0% !important;
          height: 50% !important;
          transition-delay: unset;
        }
      }

      .wing::before {
        transform: translateX(-200%) !important;
        transition-delay: unset;
      }

      .tail1 {
        top: 150% !important;
        transition: all calc(var(--duration) / 2) var(--ease);
      }

      .tail2::before {
        bottom: 100% !important;
        transition-delay: unset;
      }
    }
  }

  &.toucan2 {
    #wrapper {
      transform: translate(-50%, -50%) rotate(720deg);

      .third-qtr,
      .fourth-qtr {
        top: calc(30% + 7rem);
      }

      .fourth-qtr {
        left: 50%;
      }

      .second-qtr {
        bottom: 50%;
      }
    }

    #inner-wrapper {
      transform: translate(-50%, -50%) rotate(720deg) !important;

      .toucan-beak {
        top: 30%;
        transition-delay: calc(var(--duration) / 2);

        .beak-inner {
          top: 0;
          transition-delay: calc(var(--duration) / 2);
        }
      }

      .sun::before {
        right: 100% !important;
        transition: all calc(var(--duration) / 2) var(--ease);
      }

      .body {
        height: 20rem !important;
        width: 10rem;
        position: absolute;
        top: 30%;
        background-color: var(--purple);
        border-radius: 100% 0% 0% 100% / 50% 50% 50% 50% !important;
        transition: var(--transition);
        transform: translateY(0);

        .eye {
          top: 8%;

          span {
            top: 10%;
          }
        }

        .head {
          height: 7rem !important;
        }
      }

      .fox-head {
        transform: rotate(45deg) scale(0);
        transition-delay: calc(var(--duration) / 2);
        top: 45%;

        .eyes {
          span {
            top: 20%;
            left: -10%;
            transition-delay: unset;

            &:nth-child(2) {
              top: -10%;
              left: 20%;
            }
          }
        }
      }

      .fox-ears span {
        transition: all calc(var(--duration) / 2) var(--ease);
        top: -100%;
        transition-delay: unset;
      }

      .tail1 {
        top: calc(30% + 16.6rem) !important;
        height: 13rem;
        width: 5rem;
        background-color: var(--purple);
        transition: var(--transition);
      }
    }
  }
}

.part {
  $top: 30%;

  &.fox-head {
    height: 15rem;
    width: 15rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: rotate(45deg) scale(0);
    z-index: 5;
    overflow: hidden;
    transform-origin: top left;
    transition: all calc(var(--duration) / 2) var(--ease);

    .head {
      position: absolute;
      top: 0;
      left: 0;
      transform: translate(-22%, -72%) rotate(45deg);
      background-color: var(--purple);
      width: 200%;
      height: 200%;
      transform-origin: top left;
    }

    .eyes {
      height: 100%;
      width: 100%;

      span {
        height: 1rem;
        width: 1rem;
        background-color: white;
        border-radius: 50%;
        position: absolute;
        top: 20%;
        left: -10%;
        transition: all calc(var(--duration) / 2) var(--ease);
        transition-delay: calc(var(--duration) / 2);

        &:nth-child(2) {
          top: -10%;
          left: 20%;
        }
      }
    }
  }

  &.fox-ears {
    position: absolute;
    bottom: calc(50% - 10rem);
    left: 50%;
    transform: translate(-50%, 100%);
    height: 6rem;
    width: 20rem;
    display: flex;
    justify-content: space-between;
    overflow: hidden;
    z-index: 5;

    span {
      background-color: var(--yellow);

      height: 5rem;
      width: 5rem;
      border-radius: 0 0 0 100%;
      position: relative;
      display: inline-block;
      top: -100%;
      transition: all calc(var(--duration) / 2) var(--ease);
      transition-delay: calc(var(--duration) / 2);

      &:nth-child(1) {
        border-radius: 0 0 100% 0;
        background-color: white;
      }
    }
  }

  &.toucan-beak {
    height: 7rem;
    width: 14rem;
    overflow: hidden;
    position: absolute;
    top: 30%;
    left: 50%;
    transition: all calc(var(--duration) / 2) var(--ease);

    .beak-inner {
      height: 7rem;
      width: 14rem;
      background-color: var(--yellow);

      border-radius: 0 8rem 0 0;
      transition: all calc(var(--duration) / 2) var(--ease);
      position: absolute;
      top: 0;
      left: 0;
    }
  }

  &.body {
    height: 20rem;
    width: 10rem;
    position: absolute;
    top: $top;
    right: 50%;
    overflow: hidden;
    background-color: var(--purple);
    border-radius: 100% 0% 0% 100% / 50% 50% 50% 50%;
    transition: var(--transition);

    .eye {
      border-radius: 100% 0% 0% 100% / 50% 50% 50% 50%;
      height: calc(20rem * 0.75);
      width: calc(10rem * 0.7);
      background-color: white;
      position: absolute;
      top: 8%;
      right: 0;
      overflow: hidden;
      z-index: 1;
      transition: var(--transition);

      span {
        height: 1.3rem;
        width: 1.3rem;
        background-color: var(--purple);
        position: absolute;
        top: 10%;
        right: 15%;
        border-radius: 50%;
        transition: var(--transition);
      }
    }

    .whale-eye {
      height: 1.3rem;
      width: 1.3rem;
      background-color: white;
      position: absolute;
      top: 10%;
      right: 18%;
      border-radius: 50%;
      transition: var(--transition);
    }

    .head {
      top: 0;
      background-color: var(--red);
      height: 7rem;
      width: 100%;
      right: 0;
      position: absolute;
      transition: all calc(var(--duration) / 2) var(--ease);
      transition-delay: calc(var(--duration) / 2);
    }
  }

  &.sun {
    position: absolute;

    height: 20rem;
    width: 20rem;
    left: 50%;
    bottom: 50%;
    overflow: hidden;

    &::before {
      height: 100%;
      width: 100%;
      position: absolute;
      right: 100%;
      top: 0;
      background-color: white;
      border-radius: 50%;
      content: "";
      transition: all calc(var(--duration) / 2) var(--ease);
      transition-delay: calc(var(--duration) / 2);
    }
  }

  &.wing {
    height: 4rem;
    width: 15rem;
    overflow: hidden;
    position: absolute;
    top: calc(50% - 4rem);
    right: 50%;
    z-index: 1;

    &::before {
      position: absolute;
      height: 4rem;
      width: 12rem;
      border-radius: 40% 0% 40% 0% / 100% 0% 100% 0%;
      transition: all calc(var(--duration) / 2) var(--ease);
      transition-delay: calc(var(--duration) / 2);
      background-color: var(--yellow);
      right: 0;
      bottom: 0;
      content: "";
      transform: translateX(100%);
    }
  }

  &.tail1 {
    height: 13rem;
    width: 5rem;
    background-color: var(--purple);
    position: absolute;
    top: calc(#{$top} + 16.6rem);
    left: 50%;
    border-radius: 0% 100% 0% 100% / 0% 40% 0% 40%;
    transition: var(--transition);
  }

  &.tail2 {
    height: calc(var(--whale-body-width) / 2); // Half of whale body size
    width: 4rem;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;

    &::before {
      position: absolute;
      height: 10rem;
      width: 100%;
      border-radius: 100% 0% 100% 0% / 40% 60% 40% 0%;
      transition: all calc(var(--duration) / 2) var(--ease);
      transition-delay: calc(var(--duration) / 2);
      background-color: var(--blue);
      right: 0;
      bottom: 100%;
      content: "";
    }
  }
}

#other-work-container {
  $text-color: #666879;
  $bg-color: #acddde;
  font-family: "Roboto", "Arial", sans-serif;
  user-select: none;
  position: fixed;
  top: 3%;
  right: 3%;
  top: 0;
  right: 0;
  width: 30rem;
  height: 100vh;
  overflow: hidden;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s;
  &.show {
    opacity: 1;
  }
  .title {
    position: absolute;
    bottom: 0;
    left: 0;
    font-size: 4rem;
    font-weight: bold;
    text-transform: uppercase;
    color: rgba($text-color, 0.1);
    width: 100%;
    text-align: center;
    opacity: 0;
    transition-delay: 0s;
  }

  .menu-icon {
    height: 4rem;
    width: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    align-items: center;
    color: $text-color;
    position: absolute;
    top: 2rem;
    right: 2rem;
    pointer-events: initial;

    span {
      background-color: $text-color;
      height: 0.1em;
      width: 40%;
      display: inline-block;
      font-size: 1.3rem;
      transition: all 0.3s;
      left: 50%;
      transform: translate(-50%, -50%);
      position: absolute;

      &:nth-child(1) {
        top: 37%;
      }

      &:nth-child(2) {
        top: 50%;
      }

      &:nth-child(3) {
        top: 63%;
      }
    }
  }

  .menu-bg {
    background-color: $bg-color;
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: -1;
    height: 4rem;
    width: 4rem;
    border-radius: 50%;
    box-shadow: 0rem 0.2rem 0.3rem 0 rgba(170, 170, 170, 0.2);
    transition: all 0.3s ease-in-out;
  }

  &[data-show="true"] {
    pointer-events: initial;

    .title {
      opacity: 1;
      transition: all 0.2s linear 0.3s;
    }

    .menu-bg {
      transform: scale(50);
    }

    .menu-icon {
      span {
        top: 50%;
        left: 50%;
        width: 70%;

        &:nth-child(1) {
          transform: translate(-50%, -50%) rotate(45deg);
        }

        &:nth-child(2) {
          opacity: 0;
        }

        &:nth-child(3) {
          transform: translate(-50%, -50%) rotate(-45deg);
        }
      }
    }
  }

  .work-list {
    position: absolute;
    top: 10%;
    width: 100%;
    display: block;
    flex-direction: column;
    text-align: right;
    padding: 2rem;
    box-sizing: border-box;

    a {
      font-size: 1.5rem;
      text-decoration: none;
      padding: 1rem 0;
      text-transform: uppercase;
      color: rgba($text-color, 0.5);
      color: $text-color;
      transition: all 0s;
      opacity: 0;
      transform: translateY(-2em);
      margin-bottom: 1rem;
      display: inline-block;
      text-shadow: 0rem 0rem 0rem transparent;

      &::after {
        position: absolute;
        top: 100%;
        height: 0.15rem;
        background-color: $text-color;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        transition: all 0.3s ease-in;

        content: "";
      }

      &:hover {
        color: $text-color;
        text-shadow: 0rem 0rem 1rem rgba($text-color, 0.8);

        &::after {
          width: 100%;
        }
      }

      &.show {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 0.5s linear calc(0.05s * var(--i)),
          text-shadow 0.3s ease-in,
          transform 0.5s ease-in-out calc(0.05s * var(--i));
      }
    }
  }
}

              
            
!

JS

              
                //https://dribbble.com/shots/3381074-Animals

new Vue({
  el: "#main",
  data: {
    show_menu: false,
    works: [
      {
        name: "Toucan palette generator",
        link: "https://codepen.io/khr2003/full/rNObwwB"
      },
      {
        name: "Thumb Hover Styles",
        link: "https://codepen.io/khr2003/full/vqxygb"
      },
      {
        name: "Kalimah Gradients",
        link: "https://codepen.io/khr2003/full/RENwGK"
      },
      {
        name: "NINTENDO CONTROLLERS",
        link: "https://codepen.io/khr2003/full/gQOGQN"
      },
      {
        name: "JQUERY API",
        link: "https://codepen.io/khr2003/project/full/DNgPaw"
      }
    ]
  },
  mounted: function () {
    let root = document.documentElement;
    let duration = parseInt(
      getComputedStyle(root).getPropertyValue("--duration")
    );
    let repeat = document.querySelector("#repeat");
    let otherWork = document.querySelector("#other-work-container");

    function setPosition(length) {
      length = length || 3;
      const pos = duration + length;
      return `+=${pos}`;
    }

    var tl = new TimelineLite();
    tl.to(
      "#main",
      {
        onStart: function () {
          this.targets()[0].classList.add("whale");
          repeat.classList.remove("show");
          otherWork.classList.remove("show");
        }
      }
    );

    tl.to(
      "#main",
      {
        onStart: function () {
          this.targets()[0].classList.add("fox");
        }
      },
      setPosition()
    );

    tl.to(
      "#main",
      {
        onStart: function () {
          this.targets()[0].classList.add("toucan2");
        }
      },
      setPosition()
    );

    tl.to(
      "#wrapper, #inner-wrapper",
      {
        onStart: function () {
          root.style.setProperty("--duration", "0");
        },
        onComplete: function () {
          document
            .querySelector("#main")
            .classList.remove("whale", "fox", "toucan2");
          repeat.classList.add("show");
          otherWork.classList.add("show");
        }
      },
      setPosition(-1)
    );

    repeat.addEventListener("click", function () {
      root.style.setProperty("--duration", `${duration}s`);
      tl.invalidate().restart();
    });
  }
});

              
            
!
999px

Console