cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <body>
  <div id="foreground"></div>
  <div id="space">
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
  </div>
  <div id="controls">
    <div onclick="pause()" class="pause"></div>
    <div onclick="play()" class="play"></div>
    <div id="volume"></div>
    </div>
      <audio src="http://gordon-cheng.com/rm/doyoufeelit.mp3" id="music" loop autoplay></audio>
</body>
            
          
!
            
              body {
  overflow: hidden;
  padding: 0px;
  margin: 0px;
}

#space {
  background: #1A0000;
  width: 100%;
  height: 100%;
  -webkit-animation-name: spinCycle;
  -webkit-animation-duration: 20s;
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-delay: 0s;
  -webkit-animation-timing-function: linear;
  animation-name: spinCycle;
  animation-duration: 30s;
  animation-iteration-count: infinite;
  animation-delay: 0s;
  animation-timing-function: linear;
  -moz-animation-name: spinCycle;
  -moz-animation-duration: 30s;
  -moz-animation-iteration-count: infinite;
  -moz-animation-delay: 0s;
  -moz-animation-timing-function: linear;
  -o-animation-name: spinCycle;
  -o-animation-duration: 30s;
  -o-animation-iteration-count: infinite;
  -o-animation-delay: 0s;
  -o-animation-timing-function: linear;
}

#foreground {
  width: 100%;
  height: 100%;
  position: absolute;
  background-image: url("http://www.gordon-cheng.com/rm/foreground.png");
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 2;
}

#space,
.stars {
  overflow: hidden;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

.stars {
  background-image: radial-gradient(2px 2px at 20px 30px, #eee, rgba(0, 0, 0, 0)), radial-gradient(2px 2px at 40px 70px, #fff, rgba(0, 0, 0, 0)), radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0, 0, 0, 0)), radial-gradient(2px 2px at 90px 40px, #fff, rgba(0, 0, 0, 0)), radial-gradient(2px 2px at 130px 80px, #fff, rgba(0, 0, 0, 0)), radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0, 0, 0, 0));
  background-repeat: repeat;
  background-size: 200px 200px;
  animation: zoom 5s infinite;
  opacity: 0;
}

.stars:nth-child(1) {
  background-position: 50% 50%;
  animation-delay: 0s;
}

.stars:nth-child(2) {
  background-position: 20% 60%;
  animation-delay: 1s;
}

.stars:nth-child(3) {
  background-position: -20% -30%;
  animation-delay: 2s;
}

.stars:nth-child(4) {
  background-position: 40% -80%;
  animation-delay: 3s;
}

.stars:nth-child(5) {
  background-position: -20% 30%;
  animation-delay: 4s;
}

@keyframes zoom {
  0% {
    opacity: 0;
    transform: scale(0.5);
    animation-timing-function: ease-in;
  }
  85% {
    opacity: 1;
    transform: scale(2.8);
    animation-timing-function: linear;
  }
  100% {
    opacity: 0;
    transform: scale(3.5);
  }
}


/*Player controls*/

.ui-slider-handle {
  border-radius: 50%;
  top: -5px !important;
  width: 11px !important;
  height: 11px !important;
  margin-left: -5px !important;
  outline: none;
}

.play {
  border-top: 8px solid transparent;
  border-left: 12px solid #D1D0CE;
  border-bottom: 8px solid transparent;
  color: white;
  display: none;
}

.pause {
  width: 4px;
  height: 16px;
  border-right: 4px solid #D1D0CE;
  border-left: 4px solid #D1D0CE;
  color: white;
}

.play:hover {
  border-top: 8px solid transparent;
  border-left: 12px solid #fff;
  border-bottom: 8px solid transparent;
  color: white;
  display: none;
}

.pause:hover {
  width: 4px;
  height: 16px;
  border-right: 4px solid #fff;
  border-left: 4px solid #fff;
  color: white;
}

#controls {
  position: absolute;
  top: 4%;
  right: 4%;
  z-index: 3;
}

#volume {
  background: hsla(180, 75%, 50%, 1);
  border: none;
  height: 1px;
  position: absolute;
  width: 100px;
  right: 25px;
  top: 7px;
  -webkit-animation-name: spinCycle;
  -webkit-animation-duration: 20s;
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-delay: 0s;
  -webkit-animation-timing-function: linear;
  animation-name: spinCycle;
  animation-duration: 20s;
  animation-iteration-count: infinite;
  animation-delay: 0s;
  animation-timing-function: linear;
  -moz-animation-name: spinCycle;
  -moz-animation-duration: 20s;
  -moz-animation-iteration-count: infinite;
  -moz-animation-delay: 0s;
  -moz-animation-timing-function: linear;
  -o-animation-name: spinCycle;
  -o-animation-duration: 20s;
  -o-animation-iteration-count: infinite;
  -o-animation-delay: 0s;
  -o-animation-timing-function: linear;
}


/*Animation to change hue*/

@keyframes spinCycle {
  from {
    -webkit-filter: hue-rotate(-90deg);
    filter: hue-rotate(-90deg);
    -moz-filter: hue-rotate(-90deg);
    -o-filter: hue-rotate(-90deg);
  }
  to {
    -webkit-filter: hue-rotate(270deg);
    filter: hue-rotate(270deg);
    -moz-filter: hue-rotate(270deg);
    -o-filter: hue-rotate(270deg);
  }
}
            
          
!
            
              //Pause/play, and adjust volume

function play() {
  document.getElementById("music").play();
  $(".play").hide();
  $(".pause").show();
}

function pause() {
  document.getElementById("music").pause();
  $(".play").show();
  $(".pause").hide();
}

$(function() {
  var $aud = $("#music"),
    $vol = $('#volume'),
    AUDIO = $aud[0];
  AUDIO.volume = 0.75;
  $vol.slider({
    value: AUDIO.volume * 100,
    slide: function(ev, ui) {
      $vol.css({
        background: "hsla(180," + ui.value + "%,50%,1)"
      });
      AUDIO.volume = ui.value / 100;
    }
  });
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console