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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <audio id='tones'>
	<source src="http://www.freesound.org/data/previews/195/195396_3172867-lq.mp3"></source>
	<source src="http://www.freesound.org/data/previews/177/177156_3218184-lq.mp3"></source>
	Your browser doesn't support HTML5 audio.
 <div class='box'>
  <div class='button' id='w'></div>
  <div class='button' id='u'></div>
  <div class='button' id='b'></div>
  <div class='button' id='r'></div>
  <div class='button' id='g'></div>

  <div id='start'>Start/Reset</div>

              body {
  background-color: #d4ae5d;
  //background-size: 100%;
  //background-repeat: no-repeat;
  background-image: url(http://www.myfreetextures.com/wp-content/uploads/2011/06/another-rough-old-and-worn-parchment-paper.jpg);

.box {
  display: relative;
  //display: flex;
 // justify-content: center;
  //align-items: center;

 display: flex;
  flex-direction: column;
  justify-content: center;
.box {
  display: flex;
  flex-direction: column;
  position: relative;
  float: left;
/*   justify-content: center;
  align-items: column;
  border: dotted; */

.button {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: solid;
  opacity: .5;
  transition: opacity .25s ease-in-out;

.button:hover {
  opacity: 1;

.button.active {
  opacity: 1;
  transition: opacity 0.5s ease-in-out;

#w {
  margin-top: 100px;
  margin-left: 200px;
  background-color: white;
#u {
  margin-top: 200px;
  margin-left: 320px;
  background-color: blue;
#b {
  margin-top: 340px;
  margin-left: 280px;
  background-color: #333;
#r {
  margin-top: 340px;
  margin-left: 120px;
  background-color: red;
#g {
  margin-top: 200px;
  margin-left: 80px;
  background-color: green;

#start {
/*   display: flex;
  justify-content: center;
  align-items: center;
  position: relative; */
 /* display: inline-block;*/
  padding: 2px;
  border: solid;
 margin-top: 270px;
  margin-left: 214px;
  background: #ebe9f9;
  background: -webkit-linear-gradient(#ebe9f9 0%, #d8d0ef 50%, #cec7ec 51%, #c1bfea 100%);
  background: -moz-linear-gradient(#ebe9f9 0%, #d8d0ef 50%, #cec7ec 51%, #c1bfea 100%);
  background: -o-linear-gradient(#ebe9f9 0%, #d8d0ef 50%, #cec7ec 51%, #c1bfea 100%);
  background: linear-gradient(#ebe9f9 0%, #d8d0ef 50%, #cec7ec 51%, #c1bfea 100%); 
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebe9f9', endColorstr='#c1bfea',GradientType=0 );


              // Shorthand for $( document ).ready()
$(function() {
   var lvl = -1;
   var level = 1;
   var playerStr = '';
   var gameStr = '';
   //var colors = ['w', 'u', 'b', 'r', 'g'];
   // var audioW = new Audio("http://www.freesound.org/data/previews/1/1859_345-lq.mp3");
   // var audioU = new Audio("http://www.freesound.org/data/previews/177/177156_3218184-lq.mp3");
   // var audioB = new Audio("http://www.freesound.org/data/previews/239/239583_2698284-lq.mp3");
   // var audioR = new Audio("http://www.freesound.org/data/previews/267/267887_5025429-lq.mp3");
   // var audioG = new Audio("http://www.freesound.org/data/previews/92/92917_329264-lq.mp3");
   //var audioAll = [audioW, audioU, audioB, audioR, audioG];
  //German guy dropping F bomb
  var audioNSFW = new Audio("http://www.freesound.org/data/previews/324/324438_3284078-lq.mp3");

  var w = new Mana("w", "http://www.freesound.org/data/previews/1/1859_345-lq.mp3");
  var u = new Mana("u", "http://www.freesound.org/data/previews/177/177156_3218184-lq.mp3");
  var b = new Mana("b", "http://www.freesound.org/data/previews/239/239583_2698284-lq.mp3");
  var r = new Mana("r", "http://www.freesound.org/data/previews/267/267887_5025429-lq.mp3");
  var g = new Mana("g", "http://www.freesound.org/data/previews/92/92917_329264-lq.mp3");
  var colors = [w, u, b, r, g];
  function Mana(symbol, audio) {
	  this.symbol = symbol;
	  this.audio = new Audio(audio);
  function playAudio(color){
          case w.symbol: w.audio.play(); break;
          case u.symbol: u.audio.play(); break;
          case b.symbol: b.audio.play(); break;
          case r.symbol: r.audio.play(); break;
          case g.symbol: g.audio.play(); break;
  function levelUp(){
    playerStr = '';
    //add random note to sequence
    gameStr += colors[Math.floor(Math.random()*colors.length)].symbol;
   // play each note in sequence with 1 sec. delay
    gameStr.split('').forEach(function(note, index) {
      setTimeout(playAudio.bind(null, note), index*1000);
    // var queue = gameStr.split('');
    // playFullSequence(0);
    // function playFullSequence(index) {
    //   if(queue.length > index) {
    //     setTimeout(function() {
    //         playAudio(queue[index]);
    //         playFullSequence(++index);
    //     }, 1000);
    //   }
    // }
  function gameOver(){
    playerStr = '';
    gameStr = '';
    alert("you reached level " + lvl);

      //add id to string
       playerStr += this.id;
      //compare string
    if(playerStr.length === gameStr.length){
      if(playerStr === gameStr){
    playerStr = '';
    gameStr = '';

//   function game(attempt) {
//   };


$('.button').attr("disabled", true); 
$('.button').attr("disabled", false); 


<audio id="tones">
	<source src="http://www.freesound.org/data/previews/195/195396_3172867-lq.mp3"></source>
	<source src="http://www.freesound.org/data/previews/177/177156_3218184-lq.mp3></source>
	Your browser doesn't support HTML5 audio.

var audioW = $("#tones")[0];
🕑 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.