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

              
                <div id="game">
  <div class="corridor">
    <div class="block right">
      <div class="dash-r"></div>
      <div class="info">Find the way out.</div>
      <div class="corridor">
        <div class="block"></div>
        <div class="block"></div>
        <div class="block"></div>
        <div class="block right">
          <div class="dash-r"></div>
          <div class="corridor x width-240">
            <div class="block obstacle-crush normal"></div>
            <div class="block bottom">
              <div class="dash-b"></div>
              <div class="corridor">
                <div class="block"></div>
                <div class="block"></div>
                <div class="block left">
                  <div class="dash-l"></div>
                  <div class="corridor x width-240">
                    <div class="block smallerY10"></div>
                    <div class="block smallerY20"></div>
                    <div class="block bottom">
                      <div class="dash-b"></div>
                      <div class="corridor">
                        <div class="block right">
                          <div class="dash-r"></div>
                          <div class="corridor x width-400">
                            <div class="block top">
                              <div class="dash-t"></div>
                              <div class="corridor">
                                <div class="block right">
                                  <div class="dash-r"></div>
                                  <div class="corridor x width-160">
                                    <div class="block">
                                      <div class="goal"></div>
                                      <div class="end-screen">
                                        Congratulations!
                                        <br /> You have reached the end! ;)
                                      </div>
                                    </div>
                                    <div class="block"></div>
                                  </div>
                                </div>
                                <div class="block smallerX10 obstacle-slide-most normal"></div>
                                <div class="block smallerX20 obstacle-slide-more normal"></div>
                                <div class="block smallerX40 obstacle-slide-normal obstacle-slide-normal normal"></div>
                                <div class="block smallerX60 obstacle-slide-slight normal"></div>
                                <div class="block"></div>
                                <div class="block"></div>
                              </div>
                            </div>
                            <div class="block smallerY40 top20px"></div>
                            <div class="block obstacle-crush fast"></div>
                            <div class="block smallerY40 top20px"></div>
                            <div class="block"></div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="block top top-align-left">
              <div class="dash-t"></div>
              <div class="corridor">
                <div class="block"></div>
                <div class="block"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @keyframes crush {
	0% {
		transform: scale(1, 0);
	}

	50% {
		transform: scale(1, 1);
	}

	100% {
		transform: scale(1, 0);
	}
}

@keyframes horizontalSlideLeftSlight {
	0% {
		transform: translateX(-20px);
	}

	50% {
		transform: translateX(0);
	}

	100% {
		transform: translateX(-20px);
	}
}

@keyframes horizontalSlideLeftNormal {
	0% {
		transform: translateX(-40px);
	}

	50% {
		transform: translateX(0);
	}

	100% {
		transform: translateX(-40px);
	}
}

@keyframes horizontalSlideLeftMore {
	0% {
		transform: translateX(-60px);
	}

	50% {
		transform: translateX(0);
	}

	100% {
		transform: translateX(-60px);
	}
}

@keyframes horizontalSlideLeftMost {
	0% {
		transform: translateX(-70px);
	}

	50% {
		transform: translateX(0);
	}

	100% {
		transform: translateX(-70px);
	}
}

@keyframes pulse {
	0% {
		transform: scale(.5, .5);
	}

	50% {
		transform: scale(1, 1);
	}

	100% {
		transform: scale(.5, .5);
	}
}

.animation (@name, @time, @easing: linear, @iteration: infinite) {
	animation: @name @time @easing;
	animation-iteration-count: @iteration;
}


.crush (@time: .5s) {
	.animation(crush, @time);
}

.horizontalSlideLeftSlight (@time: .5s) {
	.animation(horizontalSlideLeftSlight, @time);
}


.horizontalSlideLeftNormal (@time: .5s) {
	.animation(horizontalSlideLeftNormal, @time);
}

.horizontalSlideLeftMore (@time: .5s) {
	.animation(horizontalSlideLeftMore, @time);
}


.horizontalSlideLeftMost (@time: .5s) {
	.animation(horizontalSlideLeftMost, @time);
}

.pulse (@time: .5s) {
	.animation(pulse, @time);
}


// Base
// ===================================== //

body {
	background:  rgb(44, 44, 39);
}

html, body {
	overflow: hidden;
}

html, body, #game {
	width: 100%;
	height: 100%;
}


// Game assets
// ===================================== //

#game {
	width: 640px;
	height: 640px;
	margin: -320px 0 0 -320px;
	position: absolute;
	top: 50%;
	left: 50%;
	border: 1px solid yellow;
}

.corridor {
	position: absolute;
	-webkit-transition: opacity 1s;
	-moz-transition: opacity 1s;
	-o-transition: opacity 1s;
	-ms-transition: opacity 1s;
	transition: opacity 1s;
}

.corridor-hover {
	width: 100%;
	height: 100%;
	position: absolute;
	left: 0;
	top: 0;
}

.corridor-hover:hover ~ .block {
	display: none;
}

.x {
	width: auto;
	height: 0;
}

.x .block {
	float: left;
}

.left .x .block {
	float: right;
}

.info {
	width: 330px;
	color: #957613;
	font: 40px/1.2 Arial, "Helvetica Neue", Helvetica, sans-serif;
	position: absolute;
	top: 42px;
	left: 87px;
	-webkit-transition: opacity 1s;
	-moz-transition: opacity 1s;
	-o-transition: opacity 1s;
	-ms-transition: opacity 1s;
	transition: opacity 1s;
}

.dash-l {
	width: 0;
	height: 0;
	padding-left: 40px;
	border-right: 40px solid #85690f;
	border-top: 40px solid transparent;
	border-bottom: 40px solid transparent;
}

.dash-r {
	width: 0;
	height: 0;
	border-left: 40px solid #85690f;
	border-top: 40px solid transparent;
	border-bottom: 40px solid transparent;
}

.dash-t {
	width: 0;
	height: 0;
	padding-top: 40px;
	border-bottom: 40px solid #85690f;
	border-left: 40px solid transparent;
	border-right: 40px solid transparent;
}

.dash-b {
	width: 0;
	height: 0;
	padding-bottom: 40px;
	border-top: 40px solid #85690f;
	border-left: 40px solid transparent;
	border-right: 40px solid transparent;
}

.goal {
	width: 30px;
	height: 30px;
	border-radius: 100%;
	margin: -15px 0 0 -15px;
	position: absolute;
	left: 50%;
	top: 50%;
	box-shadow: 0 0 10px #ffff00;
	background: #ffff00;
	.pulse(1s);
}

.end-screen {
	color: #957613;
	font: 40px/1.2 Arial, "Helvetica Neue", Helvetica, sans-serif;
	width: 100%;
	height: 100%;
	position: absolute;
	z-index: 9999;
	left: 0;
	top: 0;
	opacity: 0;
	cursor: default;
	-webkit-transition: opacity 1s;
	-moz-transition: opacity 1s;
	-o-transition: opacity 1s;
	-ms-transition: opacity 1s;
	transition: opacity 1s;
}

.end-screen:hover {
	padding: 40px;
	width: 9999px;
	height: 9999px;
	position: fixed;
	left: 0;
	top: 0;
	opacity: 1;
	background:  rgb(44, 44, 39);
}

.block {
	width: 80px;
	height: 80px;
	background: #957613;
	position: relative;
	cursor: crosshair !important;
	-webkit-transition: background 1s;
	-moz-transition: background 1s;
	-o-transition: background 1s;
	-ms-transition: background 1s;
	transition: background 1s;
}

.block:hover {
	background: #85690f;

	.info {
		opacity: 0;
		visibility: hidden;
	}
}

.right:hover,
.left:hover,
.top:hover,
.bottom:hover {
	background: #e8c967;
}


.left > .corridor {
	right: 80px;
	top: 0;
}

.right > .corridor {
	left: 80px;
	top: 0;
}

.top > .corridor {
	width: 0;
	right: 0;
	bottom: 80px;
}

.top-align-left > .corridor {
	left: 0;
}

.top > .corridor > .block {
	clear: both;
}

.bottom > .corridor {
	left: 0;
	top: 80px;
}

.block > .corridor {
	opacity: 0;
	visibility: hidden;
}

.block:hover > .corridor {
	opacity: 1;
	visibility: visible;
}

.final {
	background: rgba(255, 0, 0, .7);
}

.break {
	position: absolute;
	z-index: 2;
	background: rgb(44, 44, 39);
}


// Obstacles
// ===================================== //

.obstacle-crush {
	overflow: hidden;

	&.superFast {
		.crush(.2s);
	}

	&.fast {
		.crush(.35s);
	}

	&.normal {
		.crush(.5s);
	}

}

.obstacle-slide-slight {
	&.superFast {
		.horizontalSlideLeftSlight(.2s);
	}

	&.fast {
		.horizontalSlideLeftSlight(3s);
	}

	&.normal {
		.horizontalSlideLeftSlight(6s);
	}

}

.obstacle-slide-normal {
	&.superFast {
		.horizontalSlideLeftNormal(.2s);
	}

	&.fast {
		.horizontalSlideLeftNormal(3s);
	}

	&.normal {
		.horizontalSlideLeftNormal(6s);
	}
}

.obstacle-slide-more {
	&.superFast {
		.horizontalSlideLeftMore(.2s);
	}

	&.fast {
		.horizontalSlideLeftMore(3s);
	}

	&.normal {
		.horizontalSlideLeftMore(6s);
	}
}

.obstacle-slide-most {
	&.superFast {
		.horizontalSlideLeftMost(.2s);
	}

	&.fast {
		.horizontalSlideLeftMost(3s);
	}

	&.normal {
		.horizontalSlideLeftMost(6s);
	}
}

// Predefined sizes
// ===================================== //

.width-160 {
	width:  160px;
}

.width-240 {
	width:  240px;
}

.width-400 {
	width:  400px;
}

.smallerX60 {
	width: 60px;
}

.smallerX40 {
	width: 40px;
}

.smallerX20 {
	width: 20px;
}

.smallerX10 {
	width: 10px;
}

.smallerY60 {
	height: 60px;
}

.smallerY40 {
	height: 40px;
}

.smallerY20 {
	height: 20px;
}

.smallerY10 {
	height: 10px;
}

.top20px {
	top: 20px;
}

.top30px {
	top: 30px;
}

.top40px {
	top: 40px;
}

              
            
!

JS

              
                
              
            
!
999px

Console