123

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.

            
              <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
</head>
<body>

  <div id="rocket-animation">
    <div id="rocket-takeoff-wrapper">
      <div id="rocket-wrapper">
        <svg id="rocket" viewBox="0 0 251.5 396">
          <path id="Right_Fin" data-name="Right Fin" d="M1328.2,674.1s78.2,0,78.2,31.3S1422,846,1422,846s-46.9-156.3-93.8-125S1312.6,689.7,1328.2,674.1Z" transform="translate(-1170.5 -450)" fill="#314d51"/>
          <path id="Left_Fin" data-name="Left Fin" d="M1264.2,674.1s-78.1,0-78.1,31.3S1170.5,846,1170.5,846s46.9-156.3,93.7-125S1279.9,689.7,1264.2,674.1Z" transform="translate(-1170.5 -450)" fill="#314d51"/>
          <g id="Base_Rocket" data-name="Base Rocket">
            <path d="M1339.7,792c45.4-104.1,92.6-274.3-43.8-342-136.5,67.7-89.2,237.9-43.8,342Z" transform="translate(-1170.5 -450)" fill="#578476"/>
          </g>
          <g id="Shaded_Rocket" data-name="Shaded Rocket">
            <path d="M1296,450h-.2c-136.3,67.7-89.1,237.9-43.7,342H1296Z" transform="translate(-1170.5 -450)" fill="#04665a"/>
          </g>
          <g id="Bottom_Ring" data-name="Bottom Ring">
            <path d="M1227.7,727.9c2.5,7.6,5.1,15.2,7.8,22.6a334.4,334.4,0,0,0,120.8,0c2.7-7.3,5.3-14.9,7.8-22.6-18.6,6.3-42.3,10.1-68.1,10.1S1246.3,734.2,1227.7,727.9Z" transform="translate(-1170.5 -450)" fill="#314d51"/>
          </g>
          <g id="Top_Ring" data-name="Top Ring">
            <path d="M1296,498c19,0,36.2-4.9,49.1-12.9a156.4,156.4,0,0,0-12.5-11.8c-8.8,7.8-22,12.7-36.6,12.7s-27.9-5-36.7-12.8a156.4,156.4,0,0,0-12.5,11.8C1259.7,493.1,1277,498,1296,498Z" transform="translate(-1170.5 -450)" fill="#314d51"/>
          </g>
          <circle id="Window" cx="125.5" cy="126" r="36" fill="#314d51" stroke="#f9f9f9" stroke-miterlimit="10" stroke-width="10"/>
          <path id="Middle_Fin" data-name="Middle Fin" d="M1312.4,679.8c0-7.6-7.4-13.8-16.4-13.8s-16.4,6.2-16.4,13.8S1296,846,1296,846,1312.4,687.5,1312.4,679.8Z" transform="translate(-1170.5 -450)" fill="#314d51"/>
          <path d="M1260,792" transform="translate(-1170.5 -450)" fill="#314d51"/>
        </svg>  
        <div class="thruster">
          <div class="flame-wrapper">
            <div class="flame red"></div>
            <div class="flame orange"></div>
            <div class="flame gold"></div>
            <div class="flame white"></div>
          </div>
        </div>
      </div>
    </div>
    <svg id="planet" viewBox="0 0 2560 445">
      <g id="Layer_2" data-name="Layer 2">
        <g id="Content">
          <path d="M0,445H2560V355.3C2211.6,133.3,1765,0,1278,0,792.9,0,347.8,132.3,0,352.8Z" fill="#ffa440"/>
        </g>
      </g>
    </svg>
    <div id="sky"></div>
  </div>
  <div id="stars">
        
  </div>
  </div>
</body>
</html>
            
          
!
            
              * {
    margin: 0;
}
:root {
    --main-bg-color: #000203;
}

body {
    background: #000203;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}
#rocket-animation {
    position: absolute;
    width: 100vw;
    height: 100vh;
}
#rocket-takeoff-wrapper {
  height: 100vh;
  animation: 10s rocketTakeOff 2s forwards cubic-bezier(.97,.37,.26,.3);
}
#rocket-wrapper {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translate(-50%, 0);
}
#rocket {
    width: 200px;
    height: 200px;
}
#planet {
    position: absolute;
    bottom: -10px;
    width: 100vw;
    z-index: -10;
    animation: 5s earthLeave 2s forwards;
}
#sky {
    position: absolute;
    bottom: -100vh;
    left: -50vw;
    z-index: -20;
    background: radial-gradient(circle at center, #0784c2,var(--main-bg-color) 50%);
    border-radius: 50%;
    height: 300vh;
    width: 200vw;
    animation: 8s earthLeave 5s forwards;
}

@keyframes rocketTakeOff {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(0, -30%);
    }
}

@keyframes earthLeave {
    0% {
        transform: translatey(0);
    }
    100% {
        transform: translatey(100%);
    }
}
.thruster {
    position: relative;
    z-index: -5;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translatex(-11%);
    opacity: 0;
    animation: 500ms fadein 1s forwards;
}

@keyframes fadein {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 100;
    }
}
.flame-wrapper {
    position: relative;
    animation: flicker 600ms ease-in infinite;
}
.flame {
    bottom: 0;
    position: absolute;
    border-radius: 50% 50% 50% 0%;
    transform: rotate(-45deg);
}

.red {
    width: 45px;
    height: 45px;
    background: orangered;
    }
.orange {
    left: 5px;
    width: 35px;
    height: 35px;
    background: orange;
}
.gold {
    left: 10px;
    width: 25px;
    height: 25px;
    background: gold;
}
.white {
    left: 15px;
    width: 15px;
    height: 15px;
    background: lightyellow;
}

@keyframes flicker {
    0% {
      transform: rotate(-1deg);
    }
    20% {
      transform: rotate(2deg) scaleY(1.2);
    }
    40% {
      transform: rotate(-1deg);
    }
    60% {
      transform: rotate(1deg);
    }
    80% {
      transform: rotate(-1deg) scaleY(0.9);
    }
    100% {
      transform: rotate(1deg);
    }
}
.star-wrapper {
    position: absolute;
    height: 100%;
    z-index: -30;
    top: 0;
    animation: 20s moveStars linear infinite;
}
.star {
    position: absolute;
}
.star1 {
    height: 9px;
    width: 9px;
}
.star2 {
    height: 3px;
    width: 3px;
}

@keyframes moveStars {
    0% {
        transform: translatey(0);
    } 
    100% {
        transform: translatey(100%);
    }
}
            
          
!
            
              var starCount = 0;

window.onload = function() {
    var stars = document.getElementById('stars');
    stars.outerHTML = '<div id="stars"></div>';
    addStars();
}
function addStars() {
    console.log('test');
    var starLoop = setInterval(function() {
        console.log('test');
        var starChoice = Math.random();
        var x = Math.floor(window.innerWidth * Math.random());
        if(starChoice <= .5) {
            stars.outerHTML += `<div id="star${starCount}" class="star-wrapper"><svg class="star star1" viewBox="0 0 54 54"><g><g><rect y="18" width="54" height="18" fill="#fff"/><rect x="18" width="18" height="54" fill="#fff"/></g></g></svg></div>`;
        } else {
            stars.outerHTML += `<div id="star${starCount}" class="star-wrapper"><svg class="star star2" viewBox="0 0 18 18"><g id="Layer_2" data-name="Layer 2"><g id="Content"><rect width="18" height="18" fill="#fff"/></g></g></svg></div>`;
        }
        var currStar = document.getElementById(`star${starCount}`);
        currStar.style.left = x+'px';
        starCount++;
        if ( starCount > 200) {
            clearInterval(starLoop);
        }
    }, 200);
}
            
          
!
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