cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <button class="left" accesskey="j">j</button>
<button class="stop" accesskey="k">k</button>
<button class="right" accesskey="l">l</button>
<button class="jump-left" accesskey="i">i</button>
<button class="jump-right" accesskey="o">o</button>

<section class="background">
  <div class="mario"></div>
</section>
<section class="controls">
  <h2>Controls</h2>
<div>
  <h4>Mac:</h4>
  LEFT = CTRL + ALT + j<br>
  RIGHT = CTRL + ALT + l<br>
  JUMP LEFT = CTRL + ALT + i<br>
  JUMP RIGHT = CTRL + ALT + o
</div>
<div>
  <h4>PC (chrome): </h4>
  LEFT = ALT + j<br>
  RIGHT = ALT + l<br>
  JUMP LEFT = ALT + i<br>
  JUMP RIGHT = ALT + o
</div>
<div>
  <h4>PC (firefox): </h4>
  LEFT = SHIFT + ALT + j<br>
  RIGHT = SHIFT + ALT + l<br>
  JUMP LEFT = SHIFT + ALT + i<br>
  JUMP RIGHT = SHIFT + ALT + o
</div>
</section>



<!--<audio style="display:none;">
  <source src="http://themushroomkingdom.net/sounds/wav/smb/smb_jump-small.wav">
</audio>-->

            
          
!
            
              html, body{
  height:100%;
  margin:0;
}

button{
  width:2em;
  height:2em;
  border:3px groove #ddd;
  background:#ddd;
  text-transform:uppercase;
  position:absolute;
  z-index:10;
}
button:focus{
  background:#ccc;
}
embed{
  display:none;
}
button:focus ~ embed{
  display:block;
}
button:nth-child(1){
  top:35px;
  left:calc(50% - 30px);  
  transform: translateX(-50%);
}
button:nth-child(2){
  top:35px;
  left:50%;  
  transform: translateX(-50%);
}
button:nth-child(3){
  top:35px;
  left:calc(50% + 30px);  
  transform: translateX(-50%);
}
button:nth-child(4){
  top:5px;
  left:calc(50% - 15px);  
  transform: translateX(-50%);
}
button:nth-child(5){
  top:5px;
  left:calc(50% + 15px);  
  transform: translateX(-50%);
}

.background{
 background:url(http://www.mariomayhem.com/fun/smb_level_editor/images/overworld_bg.png);
  background-repeat: repeat-x;
  background-position: bottom;
  background-color:#5E91FE;
  height:80%;
  position:relative;
  animation:background 5s;
  -webkit-animation:background 5s;
  animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  animation-timing-function: linear;
  -webkit-animation-timing-function: linear;
  animation-play-state: paused;
  -webkit-animation-play-state: paused;
}
.background:before, .background:after{
  width:100%;
  content:'';
  display:block;
  position:absolute;
  animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  animation-timing-function: linear;
  -webkit-animation-timing-function: linear;
  animation-play-state: paused;
  -webkit-animation-play-state: paused;
}
.background:after{
  background-image:url(https://s10.postimg.org/r5fs4o1nd/cloud_lg.png);
  height:196px;
  bottom:240px;
  animation-duration:47.1s;
  -webkit-animation-duration:47.1s;
   animation-name:clouds-lg;
  -webkit-animation-name:clouds-lg;
}
.background:before{
  background-image:url(https://s10.postimg.org/679m6l1sp/cloud_sm.png);
  height:181px;
  bottom:300px;
  animation-duration:58.5s;
  -webkit-animation-duration:58.5s;
  animation-name:clouds-sm;
  -webkit-animation-name:clouds-sm;
}
.mario{
  position:absolute;
  bottom:55px;
  left:50%;
  transform: translateX(-50%);
  background-image:url(https://s15.postimg.org/anpznxccr/mario.png);
  background-position-x:0px;
  height:88px;
  width:44px;
  animation:walk .5s steps(1, end) infinite;
  -webkit-animation:walk .5s steps(1, end) infinite;
  -webkit-animation-play-state: paused;
  animation-play-state: paused;
}

.right:focus ~ .background, 
.right:focus ~ .background .mario{
  -webkit-animation-play-state: running;
  animation-play-state: running;
}
.left:focus ~ .background{
  animation-name:background2;
  -webkit-animation-name:background2;
  -webkit-animation-play-state: running;
  animation-play-state: running;
}
.left:focus ~ .background .mario{
  -ms-transform: rotateY(180deg) translateX(50%);
  -webkit-transform: rotateY(180deg) translateX(50%);
  transform: rotateY(180deg) translateX(50%);
  -webkit-animation-play-state: running;
  animation-play-state: running;
}

.left:focus ~ .background:before, .left:focus ~ .background:after,
.right:focus ~ .background:before, .right:focus ~ .background:after,
.jump-left:focus ~ .background:before, .jump-left:focus ~ .background:after,
.jump-right:focus ~ .background:before, .jump-right:focus ~ .background:after{
  -webkit-animation-play-state: running;
  animation-play-state: running;
}

.jump-right:focus ~ .background{
  -webkit-animation-play-state: running;
  animation-play-state: running;
}
.jump-right:focus ~ .background .mario{
  -webkit-animation-play-state: running;
  animation-play-state: running;
  animation:walk .5s steps(1, end) infinite, jump 1s ease;
  -webkit-animation:walk .5s steps(1, end) infinite, jump 1s ease;
}

.jump-left:focus ~ .background{
  -webkit-animation-play-state: running;
  animation-play-state: running;
  animation-name:background2;
  -webkit-animation-name:background2;
}
.jump-left:focus ~ .background .mario{
  -webkit-animation-play-state: running;
  animation-play-state: running;
  -ms-transform: rotateY(180deg) translateX(50%);
  -webkit-transform: rotateY(180deg) translateX(50%);
  transform: rotateY(180deg) translateX(50%);
  animation:walk .5s steps(1, end) infinite, jump 1s ease;
  -webkit-animation:walk .5s steps(1, end) infinite, jump 1s ease;
}

@keyframes walk{
  50%{
    background-position:-45px 0px;
  }
}
@-webkit-keyframes walk{
  50%{background-position-x:-45px;}
}
@keyframes jump{
  0%, 100%{
  background-position:-145px 0px;
  width:50px;
  }
  50%{bottom:250px;}
}
@-webkit-keyframes jump{
  0%, 100%{
  background-position-x:-145px;
  width:50px;
  }
  50%{bottom:250px;}
}
@keyframes background{
  100%{background-position:-600px 100%;}
}
@-webkit-keyframes background{
  100%{background-position-x:-600px;}
}
@keyframes background2{
  100%{background-position:600px 100%;}
}
@-webkit-keyframes background2{
  100%{background-position-x:600px;}
}
@keyframes clouds-lg{
  100%{background-position:-634px 0px;}
}
@-webkit-keyframes clouds-lg{
  100%{background-position-x:-634px;}
}
@keyframes clouds-sm{
  100%{background-position:-485px 0px;}
}
@-webkit-keyframes clouds-sm{
  100%{background-position-x:-485px;}
}

.controls{
  font-family: Courier New, Courier, monospace;
  text-align:justify;
}
.controls div{
  min-width:250px;
  padding:0 1em 1em 1em;
  display:inline-block;
}


            
          
!
            
              // I never had a Nintendo growing up so appologies for any inacuracies.

// Still a few bugs to workout but it's pretty much there.

// Follow me on twitter @M_J_Robbins

// Thanks to @SajirKun for Firefox fix
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console