Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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="middle">
    <h1 class="fourofour left center">4</h1>
    <svg class="ghost">
<path fill="black" d="M116.223,125.064c1.032-1.183,1.323-2.73,1.391-3.747V54.76c0,0-4.625-34.875-36.125-44.375
	s-66,6.625-72.125,44l-0.781,63.219c0.062,4.197,1.105,6.177,1.808,7.006c1.94,1.811,5.408,3.465,10.099-0.6
	c7.5-6.5,8.375-10,12.75-6.875s5.875,9.75,13.625,9.25s12.75-9,13.75-9.625s4.375-1.875,7,1.25s5.375,8.25,12.875,7.875
	s12.625-8.375,12.625-8.375s2.25-3.875,7.25,0.375s7.625,9.75,14.375,8.125C114.739,126.01,115.412,125.902,116.223,125.064z"></path>
<circle fill="grey" cx="86.238" cy="57.885" r="6.667"></circle>
<circle fill="grey" cx="40.072" cy="57.885" r="6.667"></circle>
<path fill="#FCEFED" stroke="" stroke-miterlimit="10" d="M116.279,55.814c-0.021-0.286-2.323-28.744-30.221-41.012
	c-7.806-3.433-15.777-5.173-23.691-5.173c-16.889,0-30.283,7.783-37.187,15.067c-9.229,9.736-13.84,26.712-14.191,30.259
	l-0.748,62.332c0.149,2.133,1.389,6.167,5.019,6.167c1.891,0,4.074-1.083,6.672-3.311c4.96-4.251,7.424-6.295,9.226-6.295	c1.339,0,2.712,1.213,5.102,3.762c4.121,4.396,7.461,6.355,10.833,6.355c2.713,0,5.311-1.296,7.942-3.962
	c3.104-3.145,5.701-5.239,8.285-5.239c2.116,0,4.441,1.421,7.317,4.473c2.638,2.8,5.674,4.219,9.022,4.219
	c4.835,0,8.991-2.959,11.27-5.728l0.086-0.104c1.809-2.2,3.237-3.938,5.312-3.938c2.208,0,5.271,1.942,9.359,5.936
	c0.54,0.743,3.552,4.674,6.86,4.674c1.37,0,2.559-0.65,3.531-1.932l0.203-0.268L116.279,55.814z M114.281,121.405
	c-0.526,0.599-1.096,0.891-1.734,0.891c-2.053,0-4.51-2.82-5.283-3.907l-0.116-0.136c-4.638-4.541-7.975-6.566-10.82-6.566
	c-3.021,0-4.884,2.267-6.857,4.667l-0.086,0.104c-1.896,2.307-5.582,4.999-9.725,4.999c-2.775,0-5.322-1.208-7.567-3.59
	c-3.325-3.528-6.03-5.102-8.772-5.102c-3.278,0-6.251,2.332-9.708,5.835c-2.236,2.265-4.368,3.366-6.518,3.366
	c-2.772,0-5.664-1.765-9.374-5.723c-2.488-2.654-4.29-4.395-6.561-4.395c-2.515,0-5.045,2.077-10.527,6.777
	c-2.727,2.337-4.426,2.828-5.37,2.828c-2.662,0-3.017-4.225-3.021-4.225l0.745-62.163c0.332-3.321,4.767-19.625,13.647-28.995
	c3.893-4.106,10.387-8.632,18.602-11.504c-0.458,0.503-0.744,1.165-0.744,1.898c0,1.565,1.269,2.833,2.833,2.833
	c1.564,0,2.833-1.269,2.833-2.833c0-1.355-0.954-2.485-2.226-2.764c4.419-1.285,9.269-2.074,14.437-2.074	c7.636,0,15.336,1.684,22.887,5.004c26.766,11.771,29.011,39.047,29.027,39.251V121.405z"></path>
    <circle fill="black" cx="47.8" cy="18" r="4"></circle>
</svg>
    <h1 class="fourofour right center">4</h1>
    <h3 class="errorDesc center">I Think You May Be Lost...</h3>
  </div>
  <a href="https://codepen.io/" target="_blank"><div class="room" data-game="room"></div></a>
  <div class="cover" data-game="torch"></div>
</body>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Ranga');
body {
  overflow: hidden;
  cursor: none;
}

.room {
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
  position: absolute;
  background: rgba(211, 31, 31, 0.3);
  cursor:none;
}

.cover {
  background: rgba(0, 0, 0, 0.85);
  height: 100%;
  width: 100%;
  left: 0px;
  top: 0px;
  position: absolute;
  pointer-events: none;
  animation: flicker 1.8s;
  -webkit-animation: flicker 1.8s;
}

.fourofour,
.errorDesc {
  margin: 0px 0px;
  font-family: 'Ranga', sans-serif;
}

.fourofour {
  font-size: 10em;
  display: inline-block;
}

.errorDesc {
  text-align: center;
  font-size: 4em;
}

.middle {
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  text-align: center;
}

.ghost {
  min-height:150px;
  max-width: 130px;
  margin: 0px 25px;
  animation: ghostly 3s ease-out infinite;
  -webkit-animation: ghostly 3s ease-out infinite;
}

@keyframes ghostly {
  0% {
    transform: translate(0, 0px);
  }
  50% {
    transform: translate(0, 25px);
  }
  100% {
    transform: translate(0, 0px);
  }
}

-webkit-@keyframes ghostly {
  0% {
    -webkit-transform: translate(0, 0px);
  }
  50% {
    -webkit-transform: translate(0, 25px);
  }
  100% {
    -webkit-transform: translate(0, 0px);
  }
}

@keyframes flicker{
  0%{
    background: rgba(0, 0, 0, 0.85);
    opacity:1;
  }
  5%{
    background: rgba(0, 0, 0, 0.65);
  }
  10%{
    background: rgba(0, 0, 0, 0.85);
  }
  15%{
    background: rgba(0, 0, 0, 0.65);
  }
  20%{
    background: rgba(0, 0, 0, 0.85);
  }
  40%{
    background: rgba(0, 0, 0, 0.85);
  }
  45%{
    background: rgba(0, 0, 0, 0.65);
  }
  50%{
    background: rgba(0, 0, 0, 0.85);
  }
  65%{
    background: rgba(0, 0, 0, 0.85);
  }
  70%{
    background: rgba(0, 0, 0, 0.65);
  }
  75%{
    background: rgba(0, 0, 0, 0.85);
  }
  80%{
    background: rgba(0, 0, 0, 0.65);
  }
  95%{
    background: rgba(0, 0, 0, 0.65);
  }
  100%{
    background: rgba(0, 0, 0, 0.85);
    opacity:1;
  }
}
-webkit-@keyframes flicker{
  0%{
    background: rgba(0, 0, 0, 0.85);
    opacity:1;
  }
  5%{
    background: rgba(0, 0, 0, 0.65);
  }
  10%{
    background: rgba(0, 0, 0, 0.85);
  }
  15%{
    background: rgba(0, 0, 0, 0.65);
  }
  20%{
    background: rgba(0, 0, 0, 0.85);
  }
  40%{
    background: rgba(0, 0, 0, 0.85);
  }
  45%{
    background: rgba(0, 0, 0, 0.65);
  }
  50%{
    background: rgba(0, 0, 0, 0.85);
  }
  65%{
    background: rgba(0, 0, 0, 0.85);
  }
  70%{
    background: rgba(0, 0, 0, 0.65);
  }
  75%{
    background: rgba(0, 0, 0, 0.85);
  }
  80%{
    background: rgba(0, 0, 0, 0.65);
  }
  95%{
    background: rgba(0, 0, 0, 0.65);
  }
  100%{
    background: rgba(0, 0, 0, 0.85);
    opacity:1;
  }
}
              
            
!

JS

              
                var torch = document.querySelectorAll('.cover')[0];
var room = document.querySelectorAll('.room')[0];

var background = 'radial-gradient(circle at %%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.85) 25%, rgba(0,0,0,0.85) 100%)';

function handleMouseover(e) {
  room.addEventListener('mousemove', handleMousemove);
}

function handleMouseout(e) {
  torch.style.background = 'rgba(0,0,0,0.85)';
  room.removeEventListener('mousemove');
}

function handleMousemove(e) {
  var style = background.replace('%%', e.offsetX + 'px ' + e.offsetY + 'px');
  torch.style.background = style;
}

room.addEventListener('mouseenter', handleMouseover);
room.addEventListener('mouseleave', handleMouseout);
              
            
!
999px

Console