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="message">
  <div class="close">
    Press&nbsp;keys
    <div class="keygroup">
      <span>q</span><span>w</span><span>e</span>
    </div>
    /
    <div class="keygroup">
      <span>a</span><span>s</span><span>d</span>
    </div>
    /
    <div class="keygroup">
      <span>z</span><span>x</span><span>c</span>
    </div>
    or <b>touch&nbsp;the&nbsp;screen</b>
  </div>
</div>

<div id="swap">
</div>

<div id="audio-clips">
  <audio id="sample1" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/woom.ogg" type="audio/ogg" />
  </audio>
  <audio id="sample2" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/touk.ogg" type="audio/ogg" />
  </audio>
  <audio id="sample3" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/blup.ogg" type="audio/ogg" />
  </audio>  
  <audio id="sample4" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/pod.ogg" type="audio/ogg" />
  </audio>
  <audio id="sample5" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/vox.ogg" type="audio/ogg" />
  </audio>  
  <audio id="sample6" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/bell.ogg" type="audio/ogg" />
  </audio>
  <audio id="sample7" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/muk.ogg" type="audio/ogg" />
  </audio>
  <audio id="sample8" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/stub.ogg" type="audio/ogg" />
  </audio> 
  <audio id="sample9" preload="auto">
    <source src="http://arnaudthuillier.com/svgparty/tiktik.ogg" type="audio/ogg" />
  </audio>  
</div>

<div id="touch-matrix">
  <div id="pad1" class="touch-btn line1 col1"></div>
  <div id="pad2" class="touch-btn line1 col2"></div>
  <div id="pad3" class="touch-btn line1 col3"></div>
  <div id="pad4" class="touch-btn line2 col1"></div>
  <div id="pad5" class="touch-btn line2 col2"></div>
  <div id="pad6" class="touch-btn line2 col3"></div>
  <div id="pad7" class="touch-btn line3 col1"></div>
  <div id="pad8" class="touch-btn line3 col2"></div>
  <div id="pad9" class="touch-btn line3 col3"></div>  
</div>

<div id="noise"></div>

<svg version="1.1" id="layer" xmlns="http://www.w3.org/2000/svg">

  <defs>
    <!-- goo filter from Chris Gannon : https://www.youtube.com/watch?v=O6dc-sJm0Ho -->
    <filter id="goo" height="300%" y="-10%">
      <feGaussianBlur in="SourceGraphic" stdDeviation="8" result="blur" />
      <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 17 -7" />
    </filter>
  </defs>
  
  <rect id="theFlash" width="100%" height="100%" />
  
  <circle id="theWave" fill="none" stroke-miterlimit="10" stroke-width="30" cx="50%" cy="50%" r="70%" />
  
  <svg viewBox="0 0 500 500">
    <g id="theBalls" filter="url(#goo)">
      <circle id="theBall1" cx="51%" cy="50%" r="40%" />
      <circle id="theBall2" cx="50%" cy="49%" r="40%" />
      <circle id="theBall3" cx="50%" cy="50%" r="40%" />
    </g>
  </svg>

  <svg viewBox="0 0 500 500">
    <g id="theStripes" fill="none" stroke-miterlimit="10" stroke-width="15">
      <line x1="450" y1="250" x2="50" y2="250" />
      <line x1="450" y1="290" x2="50" y2="290" />
      <line x1="450" y1="330" x2="50" y2="330" />
      <line x1="450" y1="210" x2="50" y2="210" />
      <line x1="450" y1="170" x2="50" y2="170" />
    </g>
  </svg>

  <svg viewBox="0 0 500 500">
    <circle id="theCircle" cx="50%" cy="50%" r="10%" />
  </svg>

  <line id="theLine" fill="none" stroke-width="15" stroke-miterlimit="1" x1="0%" y1="0%" x2="100%" y2="100%" />

  <svg viewBox="0 0 500 500">
    <g id="theSquares">
      <rect id="theSquare1" x="224.941" y="190.377" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -79.1136 239.8864)" width="50.124" height="50.124" />
      <rect id="theSquare2" x="259.499" y="224.947" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -93.4362 274.4492)" width="50.126" height="50.123" />
      <rect id="theSquare3" x="224.942" y="259.491" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -127.985 260.1282)" width="50.124" height="50.124" />
      <rect id="theSquare4" x="190.384" y="224.94" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -113.6757 225.5752)" width="50.122" height="50.122" />
    </g>
  </svg>
  
  <svg viewBox="0 0 500 500">
    <polyline id="theZig" fill="none" stroke-miterlimit="5" stroke-width="15" points="106,286 142,214 178,286 214,214 250,286 286,214 	322,286 358,214 394,286 " /> 
  </svg>
    
  <g id="theConfettis">
    <rect id="theConfetti1" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti2" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti3" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti4" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti5" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti6" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti7" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti8" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti9" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti10" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti11" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti12" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti13" x="45%" y="101%" width="80" height="20" />
    <rect id="theConfetti14" x="45%" y="101%" width="80" height="20" />
  </g>

</svg>
              
            
!

CSS

              
                // DARK COLORS
$d-pink:#FC6B9B;
$d-yellow:#FAB300;
$d-green:#48D0AC;
$d-lightpink:#FDDEE4;
$d-orange:#FE4A0F;
$d-purple:#A299D2;
$d-blue:#3B467F;
$d-darkpurple:#32243E;

.theme--dark {
  background-color:$d-darkpurple;
  #theCircle { fill:$d-yellow; }
  #theLine { stroke:$d-green; }
  #theZig { stroke:$d-orange; }
  #theFlash { fill:black; }
  #theSquares { fill:$d-blue; }
  #theStripes { stroke:$d-lightpink; }
  #theWave { stroke:$d-pink; }
  #theBalls { fill:$d-purple; }
  #theConfetti1, #theConfetti2 { fill:$d-lightpink; }
  #theConfetti3, #theConfetti4 { fill:$d-green; }
  #theConfetti5, #theConfetti6 { fill:$d-pink; }
  #theConfetti7, #theConfetti8 { fill:$d-orange; }
  #theConfetti9, #theConfetti10 { fill:$d-blue; }
  #theConfetti11, #theConfetti12 { fill:$d-yellow; }
  #theConfetti13, #theConfetti14 { fill:$d-purple; }
}

// LIGHT COLORS
$l-orange: #F4BE71;
$l-lightblue: #DAE7F2;
$l-green: #50C975;
$l-salmon: #F4929C;
$l-pink: #ED699C;
$l-blue: #307BC6;
$l-violet: #A2ACF2;

.theme--light {
  //background-color:$d-darkpurple;
  background-color:$l-lightblue;
  #theCircle { fill:$l-orange; }
  #theLine { stroke:$l-green; }
  #theZig { stroke:$l-blue; }
  #theFlash { fill:white; }
  #theSquares { fill:$l-violet; }
  #theStripes { stroke:white; }
  #theWave { stroke:$l-salmon; }
  #theBalls { fill:white; }
  #theConfetti1, #theConfetti2 { fill:$l-orange; }
  #theConfetti3, #theConfetti4 { fill:$l-green; }
  #theConfetti5, #theConfetti6 { fill:$l-pink; }
  #theConfetti7, #theConfetti8 { fill:$l-blue; }
  #theConfetti9, #theConfetti10 { fill:$l-salmon; }
  #theConfetti11, #theConfetti12 { fill:$l-violet; }
  #theConfetti13, #theConfetti14 { fill:white; }
}

:root {
  color: white;
  overflow: hidden;
  font-family: monospace;
  transition: background-color .2s ease-out;
}

svg {
  circle, rect, line, polyline {
    transition: fill .2s ease-out, stroke .2s ease-out;
  }
}

#audio-clips {
  display:none;
}

svg {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  z-index: 0;
}

#noise {
  z-index: 1000;
  opacity: .1;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  box-shadow: inset 0px 0px 200px 20px rgba(0, 0, 0, 1);
  background: url("http://arnaudthuillier.com/svgparty/noise.png");
}

#swap {
  z-index: 9999;
  position: fixed;
  right: 30px;
  bottom: 30px;
  display: block;
  background-color: $l-lightblue;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .2s ease-out;
  &.light {
    background-color: $d-darkpurple;
  }
}

#touch-matrix {
  position: fixed;
  display: block;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  z-index: 2000;
}

.touch-btn {
  position: absolute;
}

.tapped {
  background: rgba(255, 255, 255, 0.3);
}

.line1 {
  top: 0;
  height: 33.33%;
}

.line2 {
  top: 33.33%;
  height: 33.33%;
}

.line3 {
  top: 66.66%;
  height: 33.34%;
}

.col1 {
  left: 0;
  width: 33.33%;
}

.col2 {
  left: 33.33%;
  width: 33.33%;
}

.col3 {
  left: 66.66%;
  width: 33.34%;
}
  
#message {
  z-index: 3000;
  position: absolute;
  text-align: center;
  width: 100%;
  left: 0;
  bottom: 50px;
}

.close {
  display: inline-block;
  background: rgba(255,255,255,.7);
  color: #333;
  font-size: 14px;
  padding: 20px 30px 15px;
  line-height: 1.5;
  cursor: pointer;
  transition: opacity .2s;
  margin: 0 20px;
  &:hover {
    opacity: .7;
  }
  span {
    display: inline-block;
    border: 1px solid #666;
    margin: 0 1px;
    padding: 0 8px 5px 3px;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: bold;
    background: white;
    color: black;
    border-radius: 3px;
    position: relative;
    top: -2px;
  }
}

.keygroup {
  display:inline-block;
}
              
            
!

JS

              
                var select = function(s) {
    return document.querySelector(s);
  },
  selectAll = function(s) {
    return document.querySelectorAll(s);
  },
  
  // SHAPES
  theCircle = select("#theCircle"),
  theLine = select("#theLine"),
  theFlash = select("#theFlash"),
  theZig = select("#theZig"),
  theWave = select("#theWave"),
  theStripes = selectAll("#theStripes > line"),    

  theSquares = select("#theSquares"),
  theSquare1 = select("#theSquare1"),
  theSquare2 = select("#theSquare2"),
  theSquare3 = select("#theSquare3"),
  theSquare4 = select("#theSquare4"),

  theBalls = select("#theBalls"),
  theBall1 = select("#theBall1"),
  theBall2 = select("#theBall2"),
  theBall3 = select("#theBall3"),

  theConfettis = selectAll("#theConfettis rect"),  
  theConfetti1 = select("#theConfetti1"),
  theConfetti2 = select("#theConfetti2"),
  theConfetti3 = select("#theConfetti3"),
  theConfetti4 = select("#theConfetti4"),
  theConfetti5 = select("#theConfetti5"),
  theConfetti6 = select("#theConfetti6"),
  theConfetti7 = select("#theConfetti7"),
  theConfetti8 = select("#theConfetti8"),

  // <AUDIO> TAGS
  sample1 = select("#sample1"),
  sample2 = select("#sample2"),
  sample3 = select("#sample3"),
  sample4 = select("#sample4"),
  sample5 = select("#sample5"),
  sample6 = select("#sample6"),
  sample7 = select("#sample7"),
  sample8 = select("#sample8"),
  sample9 = select("#sample9"),

  // THE TIMELINES
  tlA = new TimelineMax(),
  tlB = new TimelineMax(),
  tlC = new TimelineMax(),
  tlD = new TimelineMax(),
  tlE = new TimelineMax(),
  tlF = new TimelineMax(),
  tlG = new TimelineMax(),
  tlH = new TimelineMax(),
  tlI = new TimelineMax()



// INIT SHAPE STATES
TweenMax.set(theLine, {
  drawSVG: '0% 0%'
})
TweenMax.set(theFlash, {
  opacity: 0
})
TweenMax.set(theZig, {
  drawSVG: '0% 0%'
})
TweenMax.set(theSquares, {
  opacity:0
})
TweenMax.set(theStripes, {
  opacity:0
})
TweenMax.set(theWave, {
  attr: {
    r: "100%"
  }
})
TweenMax.set(theBalls, {
  opacity: 0
})
TweenMax.set(theCircle, {
  attr: {
    r: "30%"
  }
})
TweenMax.set(theConfettis, {
  rotation:0,
  x:0,
  y:0
})


// GET RANDOM INTEGER
function rand(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}


// THE ANIMATIONS
function playFlash() {
  var opa = .3;
  tlC.progress(1);
  tlC.set(theFlash, {
      opacity: 0
    })
    .to(theFlash, .05, {
      repeat:20,
      opacity: opa
    })
}

function playSquare() {
  var dist=rand(150,180);
  var angle=(rand(0,1) ? -90 : 90);
  tlF.progress(1);
  tlF.set(theSquare1, {
      y: "-="+dist
    })
    .set(theSquare2, {
      x: "+="+dist
    })
    .set(theSquare3, {
      y: "+="+dist
    })
    .set(theSquare4, {
      x: "-="+dist
    })
    .set(theSquares, {
      opacity: 1,
      rotation: 0,
      y: "-=5"
    })
    .to(theSquares, .7, {
      opacity: 1,
      rotation: angle,
      transformOrigin: "center center"
    })
    .to(theSquare1, .6, {
      y: "+="+dist,
      ease: Power2.easeInOut
    }, "-=.6")
    .to(theSquare2, .6, {
      x: "-="+dist,
      ease: Power2.easeInOut
    }, "-=.6")
    .to(theSquare3, .6, {
      y: "-="+dist,
      ease: Power2.easeInOut
    }, "-=.6")
    .to(theSquare4, .6, {
      x: "+="+dist,
      ease: Power2.easeInOut
    }, "-=.6")
    .to(theSquares, .3, {
      opacity: 0,
      y: "+=5"
    }, "+=.3")
}

function playCircle() {
  var radius=rand(25,35);
  tlA.progress(1);
  tlA.set(theCircle, {
      attr: {
        r: "0%"
      },
      opacity: 1
    })
    .fromTo(theCircle, .3, {
      attr: {
        r: "10%"
      }
    }, {
      attr: {
        r: radius+"%"
      },
      ease: Elastic.easeOut.config(1.5, .9)
    })
    .to(theCircle, .1, {
      attr: {
        r: "0%"
      },
      opacity: 0,
      ease: Linear.easeNone
    })
}

function playWave() {
  var angleZ=rand(-60,60);
  var angleX=rand(-60,60);
  tlG.progress(1);
  tlG.set(theWave, {
      attr: {
        r: "150%"
      },
      transform:"rotateZ("+angleZ+"deg) rotateX("+angleX+"deg)"
    })
    .to(theWave, .5, {
      attr: {
        r: "0%"
      },
      transform:"rotateZ(0deg) rotateX(0deg)",
      ease: Circ.easeOut
    })
}

function playWobble() {
  var b1=rand(44,49);
  var b2=rand(46,51);
  var b3=rand(45,50);
  tlI.progress(1);
  tlI.set(theBall1, {
      rotation: 0
    })
    .set(theBall2, {
      rotation: 2
    })
    .set(theBall3, {
      rotation: 5
    })
    .set(theBalls, {
      opacity: .4
    })
    .to(theBall1, 1.6, {
      rotation: -360,
      transformOrigin: b1+"% "+b2+"%",
      ease: Linear.easeNone
    })
    .to(theBall2, 1.6, {
      rotation: 360,
      transformOrigin: b2+"% "+b3+"%",
      ease: Linear.easeNone
    }, "-=1.5")
    .to(theBall3, 1.6, {
      rotation: 360,
      transformOrigin: b2+"% "+b1+"%",
      ease: Linear.easeNone
    }, "-=1.5")
    .to(theBalls, .2, {
      opacity: 0
    }, "-=.3")
}

function playLine() {
  var rotate=Math.random()*360;
  var h=document.documentElement.clientHeight;
  var w=document.documentElement.clientWidth;
  tlB.progress(1);
  tlB.set(theLine, {
      drawSVG: "0% 0%",
      rotation: rotate,
      transformOrigin: "center center",
      attr: {
        x1: 0,
        y1: 0,
        x2: w,
        y2: h
      }
    })
    .to(theLine, .2, {
      drawSVG: '0% 100%',
      ease: Linear.easeNone
    })
    .to(theLine, .5, {
      drawSVG: '100% 100%',
      ease: Linear.easeNone
    })
}


function playConfettis() {
  var h=document.documentElement.clientHeight-100;
  var w=document.documentElement.clientWidth/2-80;
  var minH=100;
  tlE.progress(1);
  tlE.set(theConfettis, {
    rotation:0,
    rotationY:0,
    x:0,
    y:0,
    opacity:1,
    transformOrigin: "center center",
    scaleX:0.6,
    scaleY:0.6
  })
  .staggerTo(theConfettis, .3, {
    rotation: function() { return rand(-360,360); },
    x: function(){ return rand(-w,w); },
    y: function(){return rand(-minH,-h); },
    rotationY:360,
    scaleX:1,
    scaleY:1
  }, 0.05)
  // .to(theConfetti2, .4, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti3, .4, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti4, .2, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti5, .3, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti6, .4, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti7, .4, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti8, .3, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti9, .2, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti10, .4, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti11, .3, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti12, .3, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti13, .4, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  // .to(theConfetti14, .2, {
  //   rotation:rand(-360,360),
  //   x:rand(-w,w),
  //   y:rand(-minH,-h),
  //   rotationY:360,
  //   scaleX:1,
  //   scaleY:1
  // }, "-=.3")
  .to(theConfettis, .1, {
    opacity:0
  }, "+=.5")
}


function playStripes() {
  var start=100*rand(0,1);
  var end=100-start;
  tlH.progress(1);
  tlH.set(theStripes, {
      drawSVG: start+"% "+start+"%",
      opacity: 1
    })
    .to(theStripes, .5, {
      drawSVG: start+"% "+end+"%",
      ease: Power3.easeOut
    })
    .to(theStripes, .3, {
      drawSVG: end+"% "+end+"%",
      opacity: 0,
      ease: Power3.easeOut
    }, "+=.3")
}

function playZig() {
  var dist = rand(30,80);
  tlD.progress(1);
  tlD.set(theZig, {
      drawSVG: "0% 0%"
    })
    .to(theZig, .6, {
      drawSVG: "0% "+dist+"%",
      ease: Sine.easeInOut
    })
    .to(theZig, .5, {
      drawSVG: "100% 100%",
      ease: Sine.easeOut
    })
}


// KEYBOARD CONTROL
window.addEventListener("keydown", checkKeyPressed, true);
function checkKeyPressed(e) {
  if (e.keyCode == "65") { // A
    playCircle();
    sample1.currentTime=0;
    sample1.play();
  }
  if (e.keyCode == "90") { // Z
    playLine();
    sample2.currentTime=0;
    sample2.play();
  }
  if (e.keyCode == "69") { // E
    playWave();
    sample3.currentTime=0;
    sample3.play();
  }
  if (e.keyCode == "81") { // Q
    playFlash();
    sample4.currentTime=0;
    sample4.play();
  }
  if (e.keyCode == "83") { // S
    playZig();
    sample5.currentTime=0;
    sample5.play();
  }
  if (e.keyCode == "68") { // D
    playStripes();
    sample6.currentTime=0;
    sample6.play();
  }
  if (e.keyCode == "87") { // W
    playWobble();
    sample7.currentTime=0;
    sample7.play();
  }
  if (e.keyCode == "88") { // X
    playSquare();
    sample8.currentTime=0;
    sample8.play();
  }
  if (e.keyCode == "67") { // C
    playConfettis();
    sample9.currentTime=0;
    sample9.play();
  }  
}


// TOUCH CONTROL
$('#pad1').on('touchstart', function(e){
  playCircle();
  sample1.currentTime=0;
  sample1.play();
});
$('#pad2').on('touchstart', function(e){
  playLine();
  sample2.currentTime=0;
  sample2.play();
});
$('#pad3').on('touchstart', function(e){
  playWave();
  sample3.currentTime=0;
  sample3.play();
});
$('#pad4').on('touchstart', function(e){
  playFlash();
  sample4.currentTime=0;
  sample4.play();
});
$('#pad5').on('touchstart', function(e){
  playZig();
  sample5.currentTime=0;
  sample5.play();
});
$('#pad6').on('touchstart', function(e){
  playStripes();
  sample6.currentTime=0;
  sample6.play();
});
$('#pad7').on('touchstart', function(e){
  playWobble();
  sample7.currentTime=0;
  sample7.play();
});
$('#pad8').on('touchstart', function(e){
  playSquare();
  sample8.currentTime=0;
  sample8.play();
});
$('#pad9').on('touchstart', function(e){
  playConfettis();
  sample9.currentTime=0;
  sample9.play();
});


// TOUCH CONTROL FEEDBACK
$('.touch-btn').on('touchstart', function(e){
	$(this).addClass('tapped');
});
$('.touch-btn').on('touchend', function(e){
	$(this).removeClass('tapped');
});


// HIDE INSTRUCTIONS
$('.close').on('click', function(){
  $('#message').hide();
})


// SWAP THEME
$('#swap').on('click', function(){
  $('html').toggleClass('theme--light').toggleClass('theme--dark');
  $(this).toggleClass('light');
})
              
            
!
999px

Console