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

              
                <button class="high-five">
  Like
  <div class="hands">
    <svg class="left" viewBox="0 0 32 36">
      <ellipse cx="14" cy="13" rx="9" ry="11" />
      <path
        d="M16.0011 5.5C15.5011 3.5 13.5012 4 12.5012 5.5C11.5012 7 9.5 14 9.75 20M16.0011 5.5C14.9998 8 13.9981 12 13.9994 16.5M16.0011 5.5C16.5011 4.5 17.5646 2.5 18.4994 2.5C19.737 2.5 20.7439 3.28645 20.5011 4.5M23.4981 7.5C23.4981 7.5 21.9994 12 21.9994 16M23.4981 7.5C24.9981 5.5 27.0011 7 27.0011 8.5C26.7527 10.9503 25.2188 11.8879 25.4985 25.5C25.6052 30.6943 21.6939 34 16.4985 34C11.5003 34 6.59828 29.4598 6.0011 23.5C5.5001 18.5 6.64678 15.1392 7.50115 14C9.00115 12 9.51575 14.5859 9.50102 16C9.48502 17.5364 9.65 20 9.65 20M23.4981 7.5C24 6 23.5 2.5 20.5011 4.5M20.5011 4.5C19.0011 8 17.9994 11.5 17.9994 16.5"
      />
    </svg>
    <svg class="right" viewBox="0 0 32 36">
      <ellipse cx="14" cy="13" rx="9" ry="11" />
      <path
        d="M16.0011 5.5C15.5011 3.5 13.5012 4 12.5012 5.5C11.5012 7 9.5 14 9.75 20M16.0011 5.5C14.9998 8 13.9981 12 13.9994 16.5M16.0011 5.5C16.5011 4.5 17.5646 2.5 18.4994 2.5C19.737 2.5 20.7439 3.28645 20.5011 4.5M23.4981 7.5C23.4981 7.5 21.9994 12 21.9994 16M23.4981 7.5C24.9981 5.5 27.0011 7 27.0011 8.5C26.7527 10.9503 25.2188 11.8879 25.4985 25.5C25.6052 30.6943 21.6939 34 16.4985 34C11.5003 34 6.59828 29.4598 6.0011 23.5C5.5001 18.5 6.64678 15.1392 7.50115 14C9.00115 12 9.51575 14.5859 9.50102 16C9.48502 17.5364 9.65 20 9.65 20M23.4981 7.5C24 6 23.5 2.5 20.5011 4.5M20.5011 4.5C19.0011 8 17.9994 11.5 17.9994 16.5"
      />
    </svg>
  </div>
  <div class="success"><span>Liked</span></div>
</button>

<!-- twitter -->
<a class="twitter" target="_top" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
              
            
!

CSS

              
                .high-five {
  --hands-x: 4px;
  --hands-o: 0;
  --success-clip: 0%;
  --success-o: 0;
  --success-text-o: 0;

  font-family: "Poppins", Arial;
  font-size: 16px;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #ff7576;
  background-color: #fff;
  border: none;
  outline: none;
  padding: 12px 0;
  width: 124px;
  text-align: center;
  position: relative;
  line-height: 20px;
  box-shadow: 0px 4px 16px rgba(255, 146, 149, 0.1),
    0px 1px 2px rgba(255, 146, 149, 0.1);
  border-radius: 7px;
  transform: translateZ(0);
  transition: transform 0.15s, background-color 0.15s;

  &:active {
    transform: scale(0.98, 0.97) translateZ(0);
  }

  .hands {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: var(--hands-o);
    pointer-events: none;
    svg {
      display: block;
      width: 32px;
      height: 36px;
      fill: #fff;
      stroke-width: 1.5;
      stroke: currentColor;
      stroke-linecap: round;
      stroke-linejoin: round;
      transition: fill 0.15s;

      ellipse {
        stroke: none;
      }

      &.left {
        position: relative;
        z-index: 1;
        transform: translateX(var(--hands-x));
      }

      &.right {
        transform: translateX(calc(var(--hands-x) * -1)) scaleX(-1);
      }
    }
  }

  .success {
    background-color: #ff7576;
    color: #fff;
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: inherit;
    border-radius: inherit;
    overflow: hidden;
    clip-path: circle(var(--success-clip));
    opacity: var(--success-o);
    transition: background-color 0.15s;

    span {
      opacity: var(--success-text-o);
    }
  }

  &:hover {
    background-color: #fffcfc;

    .hands {
      svg {
        fill: #fffcfc;
      }
    }

    .success {
      background-color: #fe6c6d;
    }
  }
}

html {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: inherit;
  &:before,
  &:after {
    box-sizing: inherit;
  }
}

// Center
body {
  min-height: 100vh;
  display: flex;
  font-family: 'Poppins', Arial;
  justify-content: center;
  align-items: center;
  background-color: #ffeeef;
  .twitter {
    position: fixed;
    display: block;
    right: 12px;
    bottom: 12px;
    svg {
      width: 32px;
      height: 32px;
      fill: #1da1f2;
    }
  }
}
              
            
!

JS

              
                const { to, set } = gsap;

gsap.registerPlugin(MorphSVGPlugin);

document.querySelectorAll(".high-five").forEach((element) => {
  element.addEventListener("click", () => {
    if (element.active) {
      return;
    }

    element.active = true;

    if (element.liked) {
      element.liked = false;

      to(element, {
        duration: 0.1,
        "--success-text-o": 0,
      });

      to(element, {
        duration: 0.2,
        "--success-o": 0,
        clearProps: true,
        onComplete: () => {
          element.active = false;
        },
      });

      return;
    }

    element.liked = true;

    to(element, {
      "--hands-o": 1,
      duration: 0.1,
    });
    to(element, {
      keyframes: [
        {
          "--hands-x": "0px",
          duration: 0.15,
        },
        {
          "--hands-x": "41px",
          duration: 0.25,
          onStart: () => {
            to(element.querySelectorAll("path"), {
              duration: 0.15,
              morphSVG:
                "M12.75 5.5C12.2844 3.63772 9.12993 3.47933 9.12993 5.20484C9.12993 6.93036 10.5 15.5 9.5027 21M12.75 5.5C13.3343 7.83729 14 9 13.5 16.5M12.75 5.5C12.7489 4 13.083 3 14.5 3C15.917 3 16.25 4 16.5 4.5M19.9997 6.93036C19.9997 6.93036 21 11 20.5 16.5M19.9997 6.93036C19.5 4.5 22.5 6 23.25 7.83729C24 10 24.5 12.5 24.5 25C24.5 30.1954 21.6956 34 16.5002 34C11.5019 34 7.72621 29.2363 6.00278 23.5C4.50057 18.5 1.64579 17.1392 2.50017 16C4.00017 14 7 16.5 8 17.5C9.08643 18.5864 9.25 21 9.25 21M19.9997 6.93036C19.7803 5.20484 19 2.5 16.5 4.5M16.5 4.5C17 8 17.5 10 17 16.5",
            });
          },
        },
        {
          "--success-clip": "100%",
          "--success-text-o": 1,
          duration: 0.3,
          onStart: () => {
            to(element, {
              duration: 0.1,
              "--success-o": 1,
            });
          },
          onComplete: () => {
            set(element, {
              "--hands-o": 0,
            });
            set(element.querySelectorAll("path"), {
              morphSVG:
                "M16.0011 5.5C15.5011 3.5 13.5012 4 12.5012 5.5C11.5012 7 9.5 14 9.75 20M16.0011 5.5C14.9998 8 13.9981 12 13.9994 16.5M16.0011 5.5C16.5011 4.5 17.5646 2.5 18.4994 2.5C19.737 2.5 20.7439 3.28645 20.5011 4.5M23.4981 7.5C23.4981 7.5 21.9994 12 21.9994 16M23.4981 7.5C24.9981 5.5 27.0011 7 27.0011 8.5C26.7527 10.9503 25.2188 11.8879 25.4985 25.5C25.6052 30.6943 21.6939 34 16.4985 34C11.5003 34 6.59828 29.4598 6.0011 23.5C5.5001 18.5 6.64678 15.1392 7.50115 14C9.00115 12 9.51575 14.5859 9.50102 16C9.48502 17.5364 9.65 20 9.65 20M23.4981 7.5C24 6 23.5 2.5 20.5011 4.5M20.5011 4.5C19.0011 8 17.9994 11.5 17.9994 16.5",
            });
            element.active = false;
          },
        },
      ],
    });
  });
});

              
            
!
999px

Console