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 class="container">
  <div id="text">
    You Know What To Press To Jump
  </div>
  <main>
    <div class="person">
      <div class="head">
        <div class="face">
          <div class="eyes-wrapper">
            <div class="eye"></div>
            <div class="eye eye--right"></div>
          </div>
          <div class="mouth"></div>
        </div>
      </div>

      <div class="body-wrapper">
        <div class="hands-wrapper">
          <div class="hand">
            <div class="palm">
              <div class="finger"></div>
              <div class="finger"></div>
              <div class="finger"></div>
              <div class="finger"></div>
            </div>
          </div>
          <div class="hand hand--right">
            <div class="palm">
              <div class="finger"></div>
              <div class="finger"></div>
              <div class="finger"></div>
              <div class="finger"></div>
            </div>
          </div>
        </div>
        <div class="body"></div>
        <div class="belly"></div>
      </div>
      <div class="legs-container">
        <div class="legs">
          <div class="legs-top"></div>
          <div class="legs-mid"></div>
          <div class="legs-bottom"></div>
        </div>
        <div class="legs legs-right">
          <div class="legs-top"></div>
          <div class="legs-mid">
            <div class="legs-foot"></div>
          </div>
          <div class="legs-bottom"></div>
        </div>
      </div>
    </div>
    <div class="shadow"></div>
  </main>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");
:root {
  --head-width: 200px;
  --eye-width: 57px;
  --eye-width-inside: calc(var(--eye-width) - 13px);
  --skip-color: #ff0059;
  --background: #ced3d7;

  --body-height: 165px;
  --angriness: 3deg;
  --animation-duration: 1000ms;
  --animation-type: ease;
}
body {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--background);
  font-family: "Press Start 2P", cursive;
}
.container {
  display: flex;
  justify-content: center;
}
#text {
  opacity: 0;
  font-size: 1rem;
  animation: text-animation 1.2s ease-out infinite;
  text-shadow: 1px 1px black;
  color: #3f51b5;
  position: absolute;
  top: 10%;
  text-align:center;
}
#text.stop {
  animation: none;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

main {
  height: 650px;
  width: 410px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  scale: 0.5;
}

.shadow {
  width: 60%;
  height: 4px;
  background-color: black;
  opacity: 0.2;
  transform: translate(0px, 10px);
}

.animate .shadow {
  animation: shadow var(--animation-duration) var(--animation-type);
}

.head {
  width: var(--head-width);
  height: calc(var(--head-width) - 12px);
  background-color: var(--skip-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.face {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  margin-top: 50px;
}

.animate .face {
  animation: jump-face var(--animation-duration) var(--animation-type);
}

.eyes-wrapper {
  display: flex;
  align-self: stretch;
  justify-content: space-between;
  padding-left: 30px;
  padding-right: 30px;
}

.eye {
  width: var(--eye-width);
  height: var(--eye-width);
  position: relative;
  border-top: solid 4px black;
  transform: rotate(var(--angriness));
  overflow: hidden;
}

.eye::before,
.eye::after {
  content: "";
  position: absolute;
  border-bottom-left-radius: calc(var(--eye-width) * 2);
  border-bottom-right-radius: calc(var(--eye-width) * 2);
  top: 0;
}

.eye::before {
  background-color: white;
  right: 4px;
  width: var(--eye-width-inside);
  height: calc(var(--eye-width-inside) / 2);
}

.eye::after {
  border-radius: 50%;
  transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  background-color: black;
  right: calc(var(--eye-width-inside) / 4 + 4px);
  width: calc(var(--eye-width-inside) / 2);
  height: calc(var(--eye-width-inside) / 2);
}
.animate .eye::after {
  animation: jump-eyes var(--animation-duration) var(--animation-type);
}

.eye--right {
  transform: rotate(calc(var(--angriness) * -1));
}

.eye--right::before {
  right: 0px;
  left: 4px;
}

.eye--right::after {
  right: 0;
  left: calc(var(--eye-width-inside) / 4 + 4px);
}
.animate .eye--right::after {
  animation: jump-eyes var(--animation-duration) var(--animation-type);
}

.mouth {
  width: 35px;
  height: 3px;
  margin-top: -15px;
  background-color: black;
}

.body-wrapper {
  height: var(--body-height);
  position: relative;
  margin-top: -20px;
  z-index: -1;
}

.body {
  background-color: var(--skip-color);
  clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
  width: 100%;
  height: 70%;
  z-index: 2;
}
.belly {
  position: relative;
  width: 100%;
  height: 40%;
  background-color: var(--skip-color);
  border-radius: 50px;
  margin-top: -10%;
  z-index: 2;
}
.belly::after {
  content: "";
  position: absolute;
  width: 50%;
  border-radius: 40%;
  border-bottom: solid 3px black;
  height: 20%;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}
.animate .belly::after {
  animation: jump-belly var(--animation-duration) var(--animation-type);
}
.hands-wrapper {
  display: flex;
  justify-content: space-between;
  position: absolute;
  top: 0;
  width: 100%;
}

.hand {
  width: 40px;
  height: 150px;
  background-color: var(--skip-color);
  transform-origin: 30px 70px;
  transform: rotate(25deg);
}

.palm {
  width: 100%;
  height: 35px;
  position: absolute;
  bottom: -15px;
  transform: rotate(-45deg);
}

.animate .palm {
  animation: jump-palm var(--animation-duration) var(--animation-type);
}

.animate .hand--right .palm {
  animation: jump-palm--right var(--animation-duration) var(--animation-type);
}

.hand--right .palm {
  transform: rotate(45deg);
}

.palm::after {
  content: "";
  width: 100%;
  height: 100%;
  position: absolute;
  background-color: var(--skip-color);
  border-radius: 40%;
}

.finger {
  position: absolute;
  width: 15px;
  height: 100%;
  background-color: var(--skip-color);
  z-index: 1;
  border-radius: 15px;
  transform: rotate(-5deg) translate(0px, 20px);
}
.animate .finger:nth-child(1) {
  animation: jump-finger1 var(--animation-duration) var(--animation-type);
}
.animate .finger:nth-child(2) {
  animation: jump-finger2 var(--animation-duration) var(--animation-type);
}
.animate .finger:nth-child(3) {
  animation: jump-finger3 var(--animation-duration) var(--animation-type);
}
.animate .finger:nth-child(4) {
  animation: jump-finger4 var(--animation-duration) var(--animation-type);
}
.animate .hand--right .finger:nth-child(4) {
  animation: jump-finger4--right var(--animation-duration) var(--animation-type);
}

.finger:nth-child(2) {
  transform: rotate(-5deg) translate(5px, 17px);
}

.finger:nth-child(3) {
  transform: rotate(-5deg) translate(5px, 17px);
}

.finger:nth-child(4) {
  transform: rotate(15deg) translate(26px, 0px);
}

.animate .hand {
  animation: jump-hand var(--animation-duration) var(--animation-type);
}

.hand--right {
  transform-origin: 6px 70px;
  transform: rotate(-25deg);
}

.animate .hand--right {
  animation: jump-hand-right var(--animation-duration) var(--animation-type);
}

.hand--right .finger {
  transform: rotate(5deg) translate(1px, 3px);
}
.hand--right .finger:nth-child(2),
.finger:nth-child(3) {
  transform: rotate(5deg) translate(15px, 8px);
}
.hand--right .finger:nth-child(4) {
  transform: rotate(5deg) translate(26px, 12px);
}

.legs {
  --legs-height: 100px;
  height: var(--legs-height);
  width: 50%;
  z-index: -9;
  position: relative;
  margin: 0 3px;
}

.legs-right {
  transform: scaleX(-1);
}

.legs-top {
  width: 100%;
  height: 50px;
  background-color: var(--skip-color);
  transform: skew(0deg, 0deg);
  position: relative;
}
.legs-top::before {
  content: "";
  position: absolute;
  height: 30px;
  width: 100%;
  background-color: var(--skip-color);
  top: -30px;
  z-index: -9;
}
.legs-mid {
  width: 100%;
  height: 50px;
  background-color: var(--skip-color);
  transform: skew(0deg, 0deg);
}
.legs-bottom {
  width: 110%;
  height: 10px;
  background-color: var(--skip-color);
  border-radius: 10px 0 0 0;
  transform: translate(-10px, 0px);
}
.animate .legs-right .legs-top {
  animation: none;
}
.animate .legs-right .legs-top::before {
  animation: jump-leg-top-right-offset var(--animation-duration)
    var(--animation-type);
}

.animate .legs-top {
  animation: jump-leg-top var(--animation-duration) var(--animation-type);
}

.animate .legs-mid {
  animation: jump-leg-mid var(--animation-duration) var(--animation-type);
}
.animate .legs-bottom {
  animation: jump-leg-bottom var(--animation-duration) var(--animation-type);
}

.animate .legs {
  animation: jump-legs var(--animation-duration) var(--animation-type);
}
.animate .legs-right {
  animation: jump-legs-right var(--animation-duration) var(--animation-type);
}

.legs-container {
  display: flex;
  justify-content: space-between;
}

.legs-foot {
  background-color: white;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
  transform-style: preserve-3d;
  transform-origin: 50% 100%;
  transform: translate3d(0, 0, 0) rotateX(-90deg);
}

.legs-right .legs-mid {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
  padding: 5px 10px;
}
.animate .legs-right .legs-foot {
  animation: jump-legs-foot var(--animation-duration) var(--animation-type);
}
.animate .legs-right .legs-mid {
  animation: jump-legs-right-mid var(--animation-duration) var(--animation-type);
}
.animate .legs-right .legs-bottom {
  animation: jump-legs-right-bottom var(--animation-duration)
    var(--animation-type);
}

@keyframes jump-leg-bottom {
  20% {
    transform: translate(-4px, 0px);
  }
  30% {
    transform: translate(-7px, 0px) rotate(-20deg);
  }
  40% {
    transform: translate(-7px, 0px) rotate(-20deg);
  }
  50% {
    transform: translate(-7px, 0px) rotate(-20deg);
  }
  70% {
    transform: translate(-4px, 0px);
  }
}

@keyframes jump-legs-right-bottom {
  30% {
    height: 0;
  }
  40% {
    height: 0;
  }
  50% {
    height: 0;
  }
}

@keyframes jump-legs-foot {
  20% {
    transform: translate3d(0, 0, 0) rotateX(-90deg);
  }
  30% {
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
  40% {
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
  50% {
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
  70% {
    transform: translate3d(0, 0, 0) rotateX(-90deg);
  }
}

@keyframes jump-legs-right-mid {
  30% {
    clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%);
  }
  40% {
    clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%);
  }
  50% {
    clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%);
  }
}

@keyframes jump-leg-mid {
  20% {
    height: 50px;
    transform: skew(15deg, 0deg);
  }
  30% {
    height: 60px;
    transform: skew(0deg, -20deg);
  }
  40% {
    height: 60px;
    transform: skew(0deg, -20deg);
  }
  50% {
    height: 60px;
    transform: skew(0deg, -20deg);
  }
  70% {
    height: 50px;
    transform: skew(15deg, 0deg);
  }
}

@keyframes jump-leg-top {
  20% {
    transform: skew(-15deg, 0deg);
  }
  30% {
    transform: skew(0deg, -20deg);
  }
  40% {
    transform: skew(0deg, -20deg);
  }
  50% {
    transform: skew(0deg, -20deg);
  }
  70% {
    transform: skew(-15deg, 0deg);
  }
}

@keyframes jump-leg-top-right-offset {
  70% {
    transform: rotate(20deg) translate(8px, 20px);
  }
}

@keyframes jump-legs {
  20% {
    height: calc(var(--legs-height) - 20px);
    transform: translate(0px, -20px) rotate(0deg);
  }
  30% {
    height: calc(var(--legs-height) + 148px);
    transform: translate(-20px, 0px) rotate(10deg);
  }
  40% {
    height: calc(var(--legs-height) + 168px);
    transform: translate(-20px, 0px) rotate(10deg);
  }
  50% {
    height: calc(var(--legs-height) + 182px);
    transform: translate(-20px, 0px) rotate(10deg);
  }
  70% {
    height: calc(var(--legs-height) - 60px);
    transform: translate(0px, -60px) rotate(0deg);
  }
}

@keyframes jump-legs-right {
  20% {
    height: calc(var(--legs-height) - 20px);
    transform: translate(0px, -20px) rotate(0deg) scaleX(-1);
  }
  30% {
    height: calc(var(--legs-height) + 148px);
    transform: translate(20px, -20px) rotate(-10deg) scaleX(-1);
  }
  40% {
    height: calc(var(--legs-height) + 168px);
    transform: translate(20px, -20px) rotate(-10deg) scaleX(-1);
  }
  50% {
    height: calc(var(--legs-height) + 182px);
    transform: translate(20px, -20px) rotate(-10deg) scaleX(-1);
  }
  70% {
    height: calc(var(--legs-height) - 60px);
    transform: translate(0px, -60px) rotate(0deg) scaleX(-1);
  }
}

@keyframes jump-face {
  00% {
    transform: translateY(0);
  }
  10% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(20px);
  }
  30% {
    transform: translateY(20px);
  }
  40% {
    transform: translateY(20px);
  }
  50% {
    transform: translateY(0);
  }
  60% {
    transform: translateY(0);
  }
  70% {
    transform: translateY(0);
  }
  80% {
    transform: translateY(20px);
  }
  90% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes jump-hand-right {
  00% {
    transform: rotate(-25deg);
  }
  10% {
    transform: rotate(-30deg);
  }
  20% {
    transform: rotate(-40deg);
    transform-origin: 6px 50px;
  }
  30% {
    transform: rotate(-15deg);
    transform-origin: 6px 120px;
  }
  40% {
    transform: rotate(-40deg);
    transform-origin: 6px 50px;
  }
  50% {
    transform: rotate(-60deg);
    transform-origin: 7px 40px;
  }
  60% {
    transform: rotate(-60deg);
    transform-origin: 7px 40px;
  }
  70% {
    transform: rotate(-90deg);
    transform-origin: 3px 15px;
  }
  80% {
    transform: rotate(-110deg);
    transform-origin: 3px 15px;
  }
  90% {
    transform: rotate(-30deg);
    transform-origin: 7px 70px;
  }
  100% {
    transform: rotate(-15deg);
    transform-origin: 6px 120px;
  }
}

@keyframes jump-hand {
  00% {
    transform: rotate(25deg);
  }
  10% {
    transform: rotate(30deg);
  }
  20% {
    transform: rotate(40deg);
    transform-origin: 30px 50px;
  }
  30% {
    transform: rotate(15deg);
    transform-origin: 30px 120px;
  }
  40% {
    transform: rotate(40deg);
    transform-origin: 30px 50px;
  }
  50% {
    transform: rotate(50deg);
    transform-origin: 30px 40px;
  }
  60% {
    transform: rotate(60deg);
    transform-origin: 30px 40px;
  }
  70% {
    transform: rotate(90deg);
    transform-origin: 26px 15px;
  }
  80% {
    transform: rotate(110deg);
    transform-origin: 26px 15px;
  }
  90% {
    transform: rotate(30deg);
    transform-origin: 30px 70px;
  }
  100% {
    transform: rotate(15deg);
    transform-origin: 30px 120px;
  }
}

@keyframes jump-eyes {
  0% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
  10% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
  20% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
  30% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
  40% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(1px);
  }
  60% {
    transform: translateY(1px);
  }
  70% {
    transform: translateY(1px);
  }
  80% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
  90% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
  100% {
    transform: translateY(calc(var(--eye-width-inside) / 4 * -1));
  }
}

@keyframes jump-belly {
  20% {
    width: 40%;
    height: 20%;
  }
  30% {
    width: 50%;
    height: 20%;
    transform: none;
  }
  31% {
    width: 30%;
    height: 40%;
    transform: rotate(180deg) translate(-51px, 0px);
  }
  40% {
    width: 30%;
    height: 40%;
    transform: rotate(180deg) translate(-51px, 0px);
  }
  50% {
    width: 30%;
    height: 40%;
    transform: rotate(180deg) translate(-51px, 0px);
  }
  51% {
    width: 30%;
    height: 40%;
    transform: none;
  }

  90% {
    width: 40%;
    height: 20%;
  }
}

@keyframes jump-palm {
  50% {
    transform: rotate(-30deg);
  }

  60% {
    transform: rotate(-10deg);
  }
  70% {
    transform: rotate(0deg);
  }

  80% {
    transform: rotate(10deg);
  }
  90% {
    transform: rotate(-45deg);
  }
}

@keyframes jump-palm--right {
  50% {
    transform: rotate(30deg);
  }

  60% {
    transform: rotate(-10deg);
  }
  70% {
    transform: rotate(0deg);
  }

  80% {
    transform: rotate(10deg);
  }
  90% {
    transform: rotate(45deg);
  }
}

@keyframes jump-finger1 {
  50% {
    transform: rotate(-5deg) translate(0px, 20px);
  }

  60% {
    transform: rotate(5deg) translate(0px, 13px);
  }
  70% {
    transform: rotate(27deg) translate(0px, 13px);
  }
  80% {
    transform: rotate(27deg) translate(0px, 13px);
  }

  90% {
    transform: rotate(5deg) translate(0px, 20px);
  }
}

@keyframes jump-finger2 {
  50% {
    transform: rotate(-5deg) translate(11px, 19px);
  }

  60% {
    transform: rotate(-5deg) translate(13px, 19px);
  }
  70% {
    transform: rotate(15deg) translate(9px, 23px);
  }
  80% {
    transform: rotate(15deg) translate(9px, 23px);
  }

  90% {
    transform: rotate(-5deg) translate(5px, 17px);
  }
}

@keyframes jump-finger3 {
  50% {
    transform: rotate(-5deg) translate(11px, 19px);
  }

  60% {
    transform: rotate(-5deg) translate(13px, 19px);
  }
  70% {
    transform: rotate(1deg) translate(17px, 30px);
  }
  80% {
    transform: rotate(1deg) translate(17px, 30px);
  }

  90% {
    transform: rotate(-5deg) translate(5px, 17px);
  }
}

@keyframes jump-finger4 {
  50% {
    transform: rotate(5deg) translate(30px, 4px);
  }

  60% {
    transform: rotate(-12deg) translate(27px, 20px);
  }
  70% {
    transform: rotate(-13deg) translate(23px, 29px);
  }
  80% {
    transform: rotate(-13deg) translate(23px, 29px);
  }

  90% {
    transform: rotate(15deg) translate(26px, 0px);
  }
}

@keyframes jump-finger4--right {
  50% {
    transform: rotate(5deg) translate(30px, 4px);
  }

  60% {
    transform: rotate(-12deg) translate(27px, 20px);
  }
  70% {
    transform: rotate(-13deg) translate(23px, 29px);
  }
  80% {
    transform: rotate(-5deg) translate(23px, 29px);
  }

  90% {
    transform: rotate(-15deg) translate(23px, 0px);
  }
}

@keyframes shadow {
  50% {
    width: 100%;
  }
}

@keyframes text-animation {
  30% {
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
}

              
            
!

JS

              
                let animationTimer = null;
let duration = getComputedStyle(document.documentElement).getPropertyValue(
  "--animation-duration"
);
duration = parseInt(duration, 10);
let hasTouchScreen = false;

if ("maxTouchPoints" in navigator) {
  hasTouchScreen = navigator.maxTouchPoints > 0;
}

const onJump = (e) => {
  if (!hasTouchScreen && e.keyCode != 32) return;

  document.body.classList.add("animate");
  document.getElementById("text").classList.add("stop");
  animationTimer = setTimeout(() => {
    document.body.classList.remove("animate");
    animationTimer && clearTimeout(animationTimer);
  }, duration);
};

document.addEventListener("touchend", onJump);
document.onkeyup = onJump;

              
            
!
999px

Console