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="wrapper">
  <div id="level">
    <div class="inner">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <span><input type="checkbox" /></span>
      <span><input type="checkbox" /></span>
      <span><input type="checkbox" /></span>
      <span><input type="checkbox" /></span>
      <span><input type="checkbox" /></span>
      <span><input type="checkbox" /></span>
    </div>
  </div>
</div>
<div id="logo"><input type="checkbox"></div>
<div id="weapon"></div>
<div id="hud"></div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

@font-face {
  font-family: "Doom";
  src: url("https://assets.codepen.io/383755/Upheaval.woff2") format("woff2");
}

body,
html {
  image-rendering: pixelated;
  cursor: crosshair;
  position: fixed;
  overflow: hidden;
  * {
    cursor: crosshair;
  }
  &:has(.inner span:nth-of-type(6) input:checked) {
    &:before {
      opacity: 1;
    }
  }
  &:has(#logo input:checked) {
    @supports (animation-timeline: scroll()) {
      position: relative;
      overflow: auto;
    }
    #weapon {
      bottom: 50px;
    }
    #hud {
      transform: translateY(0);
    }
    &:active #weapon {
      animation: shoot 0.125s steps(3, end) 1;
      @keyframes shoot {
        to {
          background-position: -255px 20px;
        }
      }
    }
  }
}

body {
  background: #000;
}

body:before {
  content: "victory";
  color: #222;
  background: rgba(255, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  font-family: "Doom";
  font-size: 14vmin;
  backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out 0.5s;
}

// Let's hide the scrollbars

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

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #e9544b, #f9ef51 75%);
}

// Here's our character movement

@keyframes rotate {
  0% {
    transform: translateY(0px);
  }
  20% {
    transform: translateY(150px) rotate(0deg);
  }
  30% {
    transform: translateY(200px) rotate(90deg);
    transform-origin: 50% calc(50% + 100px);
  }
  40% {
    transform: translateY(300px) rotate(90deg);
    transform-origin: 50% calc(50% - 0px);
  }
  50% {
    transform: translateX(100px) translateY(300px) rotate(0deg);
    transform-origin: 50% calc(50% - 0px);
  }
  60% {
    transform: translateX(100px) translateY(400px) rotate(0deg);
    transform-origin: 50% calc(50% - 150px);
  }
  65% {
    transform: translateY(450px) rotate(-90deg);
    transform-origin: 50% calc(50% - 200px);
  }
  75% {
    transform: translateY(550px) rotate(-90deg);
    transform-origin: 50% calc(50% - 200px);
  }
  80% {
    transform: translateY(600px) rotate(-90deg);
    transform-origin: 50% calc(50% - 200px);
  }
  85% {
    transform: translateX(100px) translateY(650px) rotate(-180deg);
    transform-origin: 50% calc(50% - 200px);
  }
  90% {
    transform: translateX(100px) translateY(800px) rotate(-180deg);
    transform-origin: 50% calc(50% - 200px);
  }
  100% {
    transform: translateX(200px) translateY(800px) rotate(-180deg);
    transform-origin: 50% calc(50% - 200px);
  }
}

#level {
  transform: translateY(0px) translateZ(300px) rotateX(85deg);
}
.inner {
  animation: rotate linear;
  animation-timeline: scroll();
  animation-range: entry 0 cover 100%;
  transform-origin: 50% calc(50% + 100px);
}

body {
  display: grid;
  place-items: center;
  height: clamp(1200px, 2000vh, 2000vh);
  width: 100vw;
  pointer-events: none;
  * {
    pointer-events: none;
  }
  &:has(#logo input:checked) {
    #wrapper #level .inner {
      span:first-of-type {
        animation-play-state: running;
      }
    }
  }
  input {
    @supports (animation-timeline: scroll()) {
      pointer-events: all;
    }

    &:checked {
      pointer-events: none;
    }
  }
}

#wrapper {
  width: 600px;
  height: 600px;
  box-shadow: 0 0 0 1px;
  position: fixed;
  top: calc(50vh - 300px);
  left: calc(50vw - 300px);
  perspective: 600px;
  z-index: -1;
}

#level {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;

  transform-style: preserve-3d;
  * {
    transform-style: preserve-3d;
    &:before,
    &:after {
      transform-style: preserve-3d;
    }
  }
  .inner {
    background: url("https://assets.codepen.io/383755/C99.png");
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 0px;
    &:before {
      content: "";
      position: absolute;
      width: 100%;
      height: 100%;
      background: url("https://assets.codepen.io/383755/C64.png");
      top: 0;
      left: 0;
      transform: translateZ(calc(600px / 9));
    }
    svg {
      position: absolute;
      width: 100%;
      height: 100%;
      path {
        fill: none;
        stroke: red;
        stroke-width: 10px;
      }
    }
  }
  .inner > span {
    image-rendering: pixelated;
    grid-area: 7 / 5 / 8 / 6;
    transform-origin: bottom;
    --y: 0deg;
    --x: -90deg;
    position: relative;
    transform: rotateX(var(--x)) rotateY(var(--y)) scale(0.75) translateZ(-50px);
    animation: approach 2s steps(18, end) 1 forwards var(--delay, 0s);
    animation-play-state: paused;
    @keyframes approach {
      to {
        transform: rotateX(var(--x)) rotateY(var(--y)) scale(0.75)
          translateZ(var(--z, 50px));
      }
    }
    &:nth-of-type(2),
    &:nth-of-type(3) {
      grid-area: 5 / 3 / 6 / 4;
      --y: 90deg;
      --delay: 2s;
    }
    &:nth-of-type(3) {
      grid-area: 6 / 3 / 7 / 4;
      --z: 0px;
      --delay: 0s;
      &:before {
        background: url(https://assets.codepen.io/383755/demon1.gif) 50% 50% /
          contain no-repeat;
      }
    }
    &:nth-of-type(4) {
      grid-area: 2 / 8 / 3 / 9;
      --y: -90deg;
      --delay: 2s;
      &:before {
        background: url(https://assets.codepen.io/383755/caco-cacodemon.gif) 50%
          50% / contain no-repeat;
      }
      &:before,
      &:after {
        left: -25%;
      }
    }
    &:nth-of-type(5) {
      grid-area: 5 / 7 / 6 / 8;
      --y: -180deg;
      --delay: 2s;
      &:before {
        background: url(https://assets.codepen.io/383755/demon1.gif) 50% 100% /
          contain no-repeat;
      }
    }
    &:nth-of-type(6) {
      grid-area: 8 / 8 / 9 / 9;
      --y: -180deg;
      --delay: 0s;
      &:before {
        background: url(https://assets.codepen.io/383755/demon4.gif) 50% 100% /
          contain no-repeat;
        width: 150%;
        left: -25%;
      }
    }
    &:has(input:checked) {
      &:after {
        opacity: 1;
        animation-play-state: running;
      }
      &:before {
        opacity: 0;
      }
      & + span {
        animation-play-state: running;
      }
    }
    &:before,
    &:after {
      content: "";
      position: absolute;
      width: calc(100% - 18px);
      height: 100%;
      bottom: 0;
      left: 0;
      --offset: 3px;
      pointer-events: none;
      background: url(https://assets.codepen.io/383755/demon3.gif) 50% 25% /
        contain no-repeat;
    }
    &:after {
      --offset: 0px;
      animation: move 0.5s steps(6, end) 1 forwards;
      background: url("https://assets.codepen.io/383755/doom-explosion.png") 2px
        50% / auto 50px no-repeat;
      animation-play-state: paused;
      @keyframes move {
        to {
          background-position: calc(100% + var(--offset)) 50%;
        }
      }
      opacity: 0;
    }
    input {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      opacity: 0;
      z-index: 999;
    }
  }
  .inner > div {
    &:before,
    &:after {
      content: "";
      position: absolute;
    }
    &:nth-of-type(1) {
      grid-area: 9 / 4 / 10 / 6;
      background: url("https://assets.codepen.io/383755/C4.png");
      transform-origin: bottom;
      transform: rotateX(-90deg) rotateY(-90deg);
      &:before {
        content: "";
        position: absolute;
        width: 300%;
        height: 100%;
        top: 0;
        right: 50%;
        transform: translateZ(calc(600px / -9));
        background: inherit;
      }
    }
    &:nth-of-type(2) {
      background: url("https://assets.codepen.io/383755/C4.png");
      grid-area: 8 / 2 / 9 / 5;
      transform-origin: bottom;
      transform: rotateX(-90deg);
      &:before,
      &:after {
        height: 100%;
        width: 200%;
        right: 100%;
        top: 0;
        background: url("https://assets.codepen.io/383755/C4.png");
        transform-origin: right;
        transform: rotateY(-90deg);
      }
      &:after {
        background: url("https://assets.codepen.io/383755/C19.png");
        width: 66%;
        right: 0%;
      }
    }
    &:nth-of-type(3),
    &:nth-of-type(5) {
      grid-area: 2 / 2 / 3 / 3;
      transform-origin: bottom;
      transform: rotateX(-90deg);
      background: url("https://assets.codepen.io/383755/C19.png");
      &:before {
        width: 200%;
        height: 100%;
        left: -100%;
        transform-origin: right;
        top: 0;
        transform: rotateY(-90deg);
        background: url("https://assets.codepen.io/383755/C4.png");
      }
    }
    &:nth-of-type(4) {
      grid-area: 1 / 1 / 2 / 10;
      transform-origin: bottom;
      transform: rotateX(-90deg);
      background: url("https://assets.codepen.io/383755/C4.png");
      &:before,
      &:after {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        background: url("https://assets.codepen.io/383755/C4.png");
        transform: rotateY(90deg);
        transform-origin: right;
      }
      &:after {
        left: auto;
        right: 0;
        width: 44%;
        transform: translateZ(500px);
        background: url("https://assets.codepen.io/383755/C4.png");
      }
    }
    &:nth-of-type(5) {
      grid-area: 4 / 5 / 5 / 6;
      &:before,
      &:after {
        width: 100%;
        height: 100%;
        background: inherit;
        top: 0;
        left: 0;
        transform-origin: left;
        transform: rotateY(90deg);
      }
      &:after {
        width: 200%;
        transform: translateZ(200px);
        left: 101%;
      }
    }
  }
}

#logo {
  position: fixed;
  background: url("https://assets.codepen.io/383755/580b57fcd9996e24bc43c34d.png")
      50% 50% / auto 40vh no-repeat,
    rgba(0, 0, 0, 0.75);
  z-index: 10;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  animation: load 0.5s ease-in-out 1 forwards paused;
  pointer-events: none;
  transition: 0.3s ease-in-out;
  &:has(input:checked) {
    animation-play-state: running;
    background-position: 50% calc(50% - 100vh);
    &:before,
    &:after {
      transform: translate(-50%, 100vh);
    }
  }
  input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
  }
  &:before,
  &:after {
    content: "scroll";
    font-family: "Doom";
    color: #f9ef51;
    background-image: linear-gradient(to bottom, #e9544b 0%, #f9ef51 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 8vh;
    position: absolute;
    left: 50%;
    top: calc(50% + 10vh);
    transform: translate(-50%, 0);
    transition: 0.3s ease-in-out 0.05s;
  }
  &:before {
    -webkit-text-stroke: 2px #666;
    transition-delay: 0.1s;
  }
  &:after {
    -webkit-text-fill-color: #fff;
    content: "sorry, your browser does not support scroll timeline";
    font-family: "Press Start 2p", sans-serif;
    text-align: center;
    font-size: 3vh;
    top: calc(50% + 20vh);
    animation: flashing 0.5s ease-in-out infinite alternate;
    @keyframes flashing {
      to {
        opacity: 0.5;
      }
    }
  }
  @supports (animation-timeline: scroll()) {
    &:after {
      content: "click anywhere to start";
      font-size: 1vh;
    }
  }
  @keyframes load {
    0%,
    50% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}

#weapon {
  background: url("https://i.imgur.com/dpySZUG.png") 0% 20px / auto 1072px
    no-repeat;
  --scale: 5;
  position: fixed;
  z-index: 9;
  width: 90px;
  height: 154px;
  left: calc(50% + 7.5vh);
  bottom: -500px;
  transition: 0.5s ease-in-out 0.45s;
  transform-origin: bottom;
  transform: scale(var(--scale));
  animation: bounce 1s steps(4, end) infinite alternate;
  @keyframes bounce {
    to {
      transform: scale(var(--scale)) translateY(5px);
    }
  }
  @media (max-height: 768px) {
    --scale: 4;
  }
}

#hud {
  position: fixed;
  z-index: 999;
  background: #333;
  box-shadow: 0 0 0 5px #444;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: clamp(25px, 7.5vh, 100px);
  transform: translateY(200%);
  transition: 0.5s ease-in-out 0.3s;
  &:before {
    content: "";
    position: absolute;
    aspect-ratio: 1/1;
    height: clamp(30px, 8vh, 125px);
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 0);
    box-shadow: inset 0 0 0 1px #000, 0 0 0 5px #444;
    background: url("https://assets.codepen.io/383755/grin-doomguy.gif") 0% 50% /
        contain no-repeat,
      #666;
  }
}

              
            
!

JS

              
                /* nada nada limonada */
              
            
!
999px

Console