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.

            
              .key
    .title Key
    .planetKey.mercury(data-planet="mercury") Mercury
    .planetKey.venus(data-planet="venus") Venus
    .planetKey.earth(data-planet="earth") Earth
    .planetKey.mars(data-planet="mars") Mars
    .planetKey.jupiter(data-planet="jupiter") Jupiter
    .planetKey.saturn(data-planet="saturn") Saturn
    .planetKey.uranus(data-planet="uranus") Uranus
    .planetKey.neptune(data-planet="neptune") Neptune
#space
  #solar
    .sun
    .mercuryOrbit.orbit
      .planet.mercuryPlanetCounterSpin.mercury
        .toolTip
          p.title Mercury
          p 1 Orbit takes: 88.0 days
          .underline.left
          .underline.right
          .lowerLine
    .venusOrbit.orbit
      .planet.venusPlanetCounterSpin.venus
        .toolTip
          p.title Venus
          p 1 Orbit takes: 224.7 days
          .underline.left
          .underline.right
          .lowerLine
    .earthOrbit.orbit
      .planet.earthPlanetCounterSpin.earth
        .toolTip
          p.title Earth
          p 1 Orbit takes: 365.2 days
          .underline.left
          .underline.right
          .lowerLine
        .moonOrbit.orbit
          .moon.moonPlanetCounterSpin.planet
    .marsOrbit.orbit
      .planet.marsPlanetCounterSpin.mars
        .toolTip
          p.title Mars
          p 1 Orbit takes: 687.0 days
          .underline.left
          .underline.right
          .lowerLine
    .jupiterOrbit.orbit
      .planet.jupiterPlanetCounterSpin.jupiter
        .toolTip
          p.title Jupiter
          p 1 Orbit takes: 4332 days
          .underline.left
          .underline.right
          .lowerLine
    .saturnOrbit.orbit
      .planet.saturnPlanetCounterSpin.saturn
        .toolTip
          p.title Saturn
          p 1 Orbit takes: 10760.00 days
          .underline.left
          .underline.right
          .lowerLine
        span.ring.foreground
        span.ring.background
    .uranusOrbit.orbit
      .planet.uranusPlanetCounterSpin.uranus
        .toolTip
          p.title Uranus
          p 1 Orbit takes: 30700.00 days
          .underline.left
          .underline.right
          .lowerLine
    .neptuneOrbit.orbit
      .planet.neptunePlanetCounterSpin.neptune
        .toolTip
          p.title Neptune
          p 1 Orbit takes: 60200.00 days
          .underline.left
          .underline.right
          .lowerLine

            
          
!
            
              html, body {
  margin: 0;
  padding: 0;
  font-family: helvetica, arial, sans-serif;
}
.key {
  position: absolute;
  width: 15%;
  top: 20px;
  left: 20px;
  color: #9e9e9e;
  z-index: 100;
  .title {
    color: white;
  }
  .planetKey {
    padding: 12px 8px 12px 0;
    margin: 2px 0;
    border-bottom: #9e9e9e 1px solid;
    width:80%;
    transition: width 0.5s, border-bottom 0.5s, color 0.5s;
    &:hover {
      color: white;
      border-color: white;
      width: 100%;
      cursor: pointer;
    }
  }
}
#space {
  // background: black url('https://static.pexels.com/photos/25316/pexels-photo-25316.jpg');
  background: black url('https://zeitgeist.photo/asset/201408/zg.19kv.jpeg');
  // background: black; //jpg hi res
  // background: black url('http://i.imgur.com/dTRWacy.png'); //png hi res
  background-size: cover;
  background-position: center;
  width: 100vw;
  height: 100vh;
  display: flex; // flex
  align-items: center; // flex
  justify-content: center; // flex
  #solar {
    width: 80vw;
    height: 80vh;
    // background-color: grey;
    position: relative;
    display: flex; // flex
    align-items: center; // flex
    justify-content: center; // flex
    perspective: 1400px;
    .sun {
      width: 180px;
      height: 180px;
      border-radius: 90px;
      background: yellow center center no-repeat;
      background-size: cover;
      position: absolute;
      z-index: 10000;
      // animation: zIndexSun 10s linear infinite;
      box-shadow: 
        inset 0px 0px 90px rgba(255,255,255,0.5),
        inset 0px 0px 20px rgba(255,255,255,0.5),
        0px 0px 90px rgba(255,255,255,0.9);
    }
    .planet {
      border-radius: 50px;
      .toolTip {
          position: absolute;
          width: 200px;
          top: -130px;
          height: 100px;
          p {
            color: white;

            -webkit-transition: opacity .25s linear .4s;
            opacity: 0;
          }
          &.active {
            p {
              opacity: 1;
            }
            .underline {
              &.left {
                width: 50%;
              }
              &.right {
                width: 50%;
              }
            }
            .lowerLine{
                height: 20px;
            }
          }
          .underline {
            height: 1px;
            width: 0%;
            background-color: rgba(255,255,255,1);
            position: absolute;
            bottom: 0;
            -webkit-transition: width .25s linear .2s;
            &.left {
              left: 50%;
             }
            &.right {
              right: 50%;
            }
          }
          .lowerLine {
            width: 1px;
            height: 0px;
            background-color: white;
            position: absolute;
            left: 95px;
            bottom: -20px;
            -webkit-transition: height .2s linear 0s;
          }
        }
      &.mercury {
        width: 10px;
        height: 10px;
        background: grey center center no-repeat;
        background-size: cover;
        box-shadow: inset 0px 0px 5px rgba(0,0,0,0.5);
        .toolTip {
           left: -90px;
        }
      }
      &.venus {
        width: 15px;
        height: 15px;
        background: orange center center no-repeat;
        background-size: cover;
        box-shadow: inset 0px 0px 8px rgba(0,0,0,0.5);
        .toolTip {
           left: -89px;
        }
      }
      &.earth {
        width: 17px;
        height: 17px;
        background: LightSkyBlue center center no-repeat;
        background-size: cover;
        box-shadow: inset 0px 0px 10px rgba(0,0,0,0.5);
        .toolTip {
           left: -88px;
        }
      }
      .moon {
        width: 5px;
        height: 5px;
        box-shadow: inset 0px 0px 2px rgba(0,0,0,0.5);
        background: url('http://i.imgur.com/vKR5dtA.png') center center no-repeat;
        background-size: cover;
        background-color: #b7b7b7;
      }
      &.mars {
        width: 12px;
        height: 12px;
        background: sienna center center no-repeat;
        background-size: cover;
        box-shadow: inset 0px 0px 7px rgba(0,0,0,0.5);
        .toolTip {
           left: -88px;
        }
      }
      &.jupiter {
        width: 90px;
        height: 90px;
        background: beige center center no-repeat;
        background-size: cover;
        // box-shadow: inset 0px 0px 50px 10px rgba(0,0,0,0.5);
        .toolTip {
           left: -50px;
        }
      }
      &.saturn {
        width: 80px;
        height: 80px;
        background: ivory center center no-repeat;
        background-size: cover;
        position: relative;
        perspective: 200px;
        .toolTip {
           left: -55px;
        }
        // box-shadow: inset 0px 0px 50px rgba(0,0,0,0.5), inset 0px 0px 1px rgba(0,0,0,0.9);
        .ring {
          &.foreground {
            width: 100px;
            margin-left: -34px; // plus 2px for every extra px on the border width
            margin-top: -22px; // plus 2px for every extra px on the border width
            border-radius: 600px;
            height: 100px;
            border-left: 25px solid #e0b779;
            border-right: 25px solid #e0b779;
            border-bottom: 25px solid #e0b779;
            // border-right-width: 25px;
            // border-right-style: solid;
            // border-right-image: linear-gradient(to bottom, black, rgba(0, 0, 0, 0)) 1 100%;
            position: absolute;
            transform: rotateX(82deg);
            // transform: rotate3D(10deg);
          }
          &.background {
            
          }
        }
      }
      &.uranus {
        width: 40px;
        height: 40px;
        background: LightCyan center center no-repeat;
        background-size: cover;
        box-shadow: inset 0px 0px 25px rgba(0,0,0,0.5);
        .toolTip {
           left: -75px;
        }
      }
      &.neptune {
        width: 38px;
        height: 38px;
        background: blue center center no-repeat;
        background-size: cover;
        box-shadow: inset 0px 0px 25px rgba(0,0,0,0.5);
        .toolTip {
           left: -78px;
        }
      }
    }
    .orbit {
      position: absolute;
      transform-style: preserve-3d;
      display: flex;
      align-items: center;
    }
    .mercuryOrbit {
      width: 20%;
      height: 10%;
      z-index: -4500;
      // background-color: rgba(255,255,255,0.2);
    }
    .venusOrbit {
      width: 25%;
      height: 10%;
      // z-index: 4500;
      // background-color: rgba(255,255,255,0.2);
    }
    .earthOrbit {
      width: 30%;
      height: 10%;
      // z-index: 4500;
      // background-color: rgba(255,255,255,0.2);
    }
    .moonOrbit {
      width: 260%;
      height: 10%;
      left: -80%;
      top: 40%;
      z-index: 0;
      // background-color: rgba(255,255,255,0.2);
    }
    .marsOrbit {
      width: 35%;
      height: 10%;
      // z-index: 5000;
      // background-color: rgba(255,255,255,0.2);
    }
    .jupiterOrbit {
      width: 60%;
      height: 10%;
      // z-index: 5500;
      // background-color: rgba(255,255,255,0.2);
    }
    .saturnOrbit {
      width: 78%;
      height: 10%;
      // z-index: 5500;
      // background-color: rgba(255,255,255,0.2);
    }
    .uranusOrbit {
      width: 90%;
      height: 10%;
      // z-index: 5500;
      // background-color: rgba(255,255,255,0.2);
    }
    .neptuneOrbit {
      width: 100%;
      height: 10%;
      // z-index: 5500;
      // background-color: rgba(255,255,255,0.2);
    }
  }
}
.planetCounterSpin {
  animation: planetCounterRotation 10s linear infinite;
}

.mercuryOrbit {
  animation: rotatingMercury 2.4s linear infinite;
}
.mercuryPlanetCounterSpin {
  animation: planetCounterRotation 2.4s linear infinite, mercuryVenusMarsBoxShadow 2.4s linear infinite;
}

.venusOrbit {
  animation: rotatingVenus 6.25s linear infinite;
}
.venusPlanetCounterSpin {
  animation: planetCounterRotation 6.25s linear infinite, mercuryVenusMarsBoxShadow 6.25s linear infinite; // 224.7
}

.earthOrbit {
  animation: rotatingEarth 10s linear infinite;
}
.earthPlanetCounterSpin {
  animation: planetCounterRotation 10s linear infinite, earthBoxShadow 10s linear infinite;
}

.moonOrbit {
  animation: rotatingMoon 2s linear infinite;
}
.moonPlanetCounterSpin {
  animation: planetCounterRotation 2s linear infinite;
}

.marsOrbit {
  animation: rotatingMars 20s linear infinite;
}
.marsPlanetCounterSpin {
  animation: planetCounterRotation 20s linear infinite, mercuryVenusMarsBoxShadow 20s linear infinite;
}

.jupiterOrbit {
  animation: rotatingJupiter 120s linear infinite;
}
.jupiterPlanetCounterSpin {
  animation: planetCounterRotation 120s linear infinite, satJupBoxShadow 120s linear infinite;
}

.saturnOrbit {
  animation: rotatingSaturn 250s linear infinite;
}
.saturnPlanetCounterSpin {
  animation: planetCounterRotation 250s linear infinite, satJupBoxShadow 250s linear infinite;
}

.uranusOrbit {
  animation: rotatingUranus 500s linear infinite;
}
.uranusPlanetCounterSpin {
  animation: planetCounterRotation 500s linear infinite, uranusNeptuneBoxShadow 500s linear infinite;
}

.neptuneOrbit {
  animation: rotatingNeptune 600s linear infinite;
}
.neptunePlanetCounterSpin {
  animation: planetCounterRotation 600s linear infinite, uranusNeptuneBoxShadow 600s linear infinite;
}

@keyframes rotatingMercury {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 11000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 9000; } }
@keyframes rotatingVenus {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 12000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 8000; } }
@keyframes rotatingEarth {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 13000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 7000; } }
@keyframes rotatingMoon {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 12500; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 6500; } }
@keyframes rotatingMars {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 14000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 6000; } }
@keyframes rotatingJupiter {
  from { transform: rotate3d(0, 1, 0, 0deg);
           z-index: 15000; }
  to { transform: rotate3d(0, 1, 0, 360deg); 
       z-index: 5000; } }
@keyframes rotatingSaturn {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 16000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 4000; } }
@keyframes rotatingUranus {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 17000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 3000; } }
@keyframes rotatingNeptune {
  from { transform: rotate3d(0, 1, 0, 0deg);
         z-index: 18000; }
  to { transform: rotate3d(0, 1, 0, 360deg);
      z-index: 2000; } }

$shadowCol: rgba(0,0,0,0.9);
$shadowFeather: 4px;
$super: inset 0px 0px 20px 5px rgba(0,0,0,0.5), inset 0px 0px 0px 1px rgba(0,0,0,0.8);

@keyframes satJupBoxShadow {
  0% { box-shadow: inset 40px 0px $shadowFeather 0px $shadowCol, $super; }
  25% { box-shadow: inset 100px 0px $shadowFeather 0px $shadowCol, $super; }
  25.01% { box-shadow: inset -100px 0px $shadowFeather 0px $shadowCol, $super; }
  50% { box-shadow: inset -40px 0px $shadowFeather 0px $shadowCol, $super; }
  75% { box-shadow: inset 0px 0px $shadowFeather 0px $shadowCol, $super; }
  100% { box-shadow: inset 40px 0px $shadowFeather 0px $shadowCol, $super; }
}
@keyframes earthBoxShadow {
  0% { box-shadow: inset 8px 0px $shadowFeather 0px $shadowCol; }
  25% { box-shadow: inset 20px 0px $shadowFeather 0px $shadowCol; }
  25.01% { box-shadow: inset -20px 0px $shadowFeather 0px $shadowCol; }
  50% { box-shadow: inset -8px 0px $shadowFeather 0px $shadowCol; }
  75% { box-shadow: inset 0px 0px $shadowFeather 0px $shadowCol; }
  100% { box-shadow: inset 8px 0px $shadowFeather 0px $shadowCol; }
}
@keyframes mercuryVenusMarsBoxShadow {
  0% { box-shadow: inset 5px 0px $shadowFeather 0px $shadowCol; }
  25% { box-shadow: inset 20px 0px $shadowFeather 0px $shadowCol; }
  25.01% { box-shadow: inset -20px 0px $shadowFeather 0px $shadowCol; }
  50% { box-shadow: inset -5px 0px $shadowFeather 0px $shadowCol; }
  75% { box-shadow: inset 0px 0px $shadowFeather 0px $shadowCol; }
  100% { box-shadow: inset 5px 0px $shadowFeather 0px $shadowCol; }
}
@keyframes uranusNeptuneBoxShadow {
  0% { box-shadow: inset 20px 0px $shadowFeather 0px $shadowCol; }
  25% { box-shadow: inset 50px 0px $shadowFeather 0px $shadowCol; }
  25.01% { box-shadow: inset -50px 0px $shadowFeather 0px $shadowCol; }
  50% { box-shadow: inset -20px 0px $shadowFeather 0px $shadowCol; }
  75% { box-shadow: inset 0px 0px $shadowFeather 0px $shadowCol; }
  100% { box-shadow: inset 20px 0px $shadowFeather 0px $shadowCol; }
}


@keyframes planetCounterRotation {
  from { transform: rotate3d(0, -1, 0, 0deg); }
  to { transform: rotate3d(0, -1, 0, 360deg); } }

@keyframes venusCounterRotating {
  from { transform: rotate3d(0, -1, 0, 0deg); }
  to { transform: rotate3d(0, -1, 0, 360deg); } }
@keyframes earthCounterRotating {
  from { transform: rotate3d(0, -1, 0, 0deg); }
  to { transform: rotate3d(0, -1, 0, 360deg); } }
@keyframes moonCounterRotating {
  from { transform: rotate3d(0, -1, 0, 0deg); }
  to { transform: rotate3d(0, -1, 0, 360deg); } }
@keyframes marsCounterRotating {
  from { transform: rotate3d(0, -1, 0, 0deg); }
  to { transform: rotate3d(0, -1, 0, 360deg); } }
@keyframes jupiterCounterRotating {
  from { transform: rotate3d(0, -1, 0, 0deg); }
  to { transform: rotate3d(0, -1, 0, 360deg); } }

@keyframes zIndexSun {
  from { z-index: 3000; }
  to { z-index: 7500; }
}
            
          
!
            
              const planets = document.querySelectorAll('.key .planetKey');
// var saturn = document.querySelector('.key .saturn');
// console.log(saturn);
// saturn.addEventListener('click', function(){
//   console.log('its me, saturn');
// })
// console.log(planets);
function handleClick(){
  const toolTip = document.querySelector('#space .' + `${this.dataset.planet}` + ' .toolTip');
  toolTip.classList.toggle('active');
  // console.log(toolTip);
  // console.log(this.name);
}
planets.forEach(planet => planet.addEventListener('click', handleClick));
            
          
!
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.

Console