Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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='rocket'></div>
<div id='exhaust'></div>
<div id='sky'></div>
<section>scroll to launch</section>
<section></section>
<section></section>
<section></section>
              
            
!

CSS

              
                :root {
  --base-padding: 3vw;
  --white-25: rgba(255,255,255,.25);
  --white-50: rgba(255,255,255,.5);
}
body {
  margin: var(--base-padding);
  font-family: system-ui;
}

* {
  box-sizing: border-box;
}

section {
  display: block;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

#rocket {
  width: 40px;
  height: 125px;
  background:
    linear-gradient(to right, transparent 45%, firebrick 45%, firebrick 55%, transparent 55%),
    radial-gradient(circle at 50% 40%, rgba(255,255,255,1) 10%, #aaa 11%, #aaa 15%, transparent 16%),
    linear-gradient(to right, transparent 50%, rgba(0,0,0,.1) 50%),    
    linear-gradient(to bottom, firebrick 12%, transparent 12%),
    lightgray;
  background-size: 100% 40%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-position: 50% 95%, 0 0, 0 0, 0 0, 0 0;
  background-repeat: no-repeat;
  border-radius: 50px 50px 50px 50px / 200px 200px 10px 10px;  
  position: fixed;
  bottom: 0;
  left: calc(50% - 20px);
  box-shadow: 0 15px 0 -5px #666;
  filter: drop-shadow(0px -5px 2px rgba(0,0,0,.15));
}

#rocket:before {
  content:'';
  width: 200%;
  height: 50%;
  position: absolute;
  top: 55%;
  left: -50%;
  background: 
    radial-gradient(circle at 50% 100%, transparent 50%, firebrick 51%);
  clip-path: polygon(0% 0%, 25% 0%, 25% 100%, 75% 100%, 75% 0%, 100% 0%, 100% 100%, 0% 100%);
  border-radius: 100% 100% 0 0;
}
#rocket:after {
  content:'';
  width: 60%;
  height: 25%;
  position: absolute;
  top: 108%;
  left: 20%;
  background:
    linear-gradient(to bottom, orangered, gold);
  border-radius: 0 0 25% 25%;
  filter: blur(2px);
  opacity: .5;
  animation: blast_off .25s linear infinite;
}

@keyframes blast_off {
  33% { 
    background:
      linear-gradient(to bottom, orangered 25%, gold 75%);
  }
  66% { 
    background:
      linear-gradient(to bottom, orangered 50%, gold 90%);
  }
}


.shake_rocket {
  animation: shake .1s linear infinite;
}
@keyframes shake {
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}

#sky {
  min-height: 200vh;
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  background: 
    radial-gradient(circle at 75% 24%, rgba(255,255,255,.5) .25%, transparent .25%),
    radial-gradient(circle at 10% 23%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 98% 29%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 63% 10%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 20% 6%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 75% 5%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 35% 15%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 94% 10%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 55% 30%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 4% 40%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at 91% 35%, rgba(255,255,255,.25) .25%, transparent .25%),
    radial-gradient(circle at -1% 3%, rgba(0,0,0,.15) 2%, transparent 2.5%),
    radial-gradient(circle at 11% 6.5%, rgba(0,0,0,.15) 1%, transparent 1.5%),
    radial-gradient(circle at 15% 0%, rgba(0,0,0,.15) 2%, transparent 2.5%),
    radial-gradient(circle at 5% 8%, rgba(0,0,0,.15) 2%, transparent 2.5%),
    radial-gradient(circle at -5% -5%, rgba(255,255,255,.15) 9%, transparent 10%),
    radial-gradient(circle at 0% 0%, #888 10%, transparent 12%),
    linear-gradient(to top, beige, #306);
  z-index: -1;
}

#exhaust {
  width: 400px;
  height: 100px;
  position: fixed;
  bottom: -50px;
  left: calc(50% - 200px);
  opacity: 0;
  transition-origin: 50% 100%;
  transition: 1s;
}
#exhaust:after {
  content: '';
  width: 400px;
  height: 100px;
  position: absolute;
  bottom: 0;
  left: 0;
  background:
    radial-gradient(circle at 20% 90%, white 50px, transparent 51px),
    radial-gradient(circle at 35% 115%, white 50px, transparent 51px),
    radial-gradient(circle at 50% 135%, white 50px, transparent 51px),
    radial-gradient(circle at 65% 115%, white 50px, transparent 51px),
    radial-gradient(circle at 80% 90%, white 50px, transparent 51px);
  filter: blur(1px) drop-shadow(0px -5px rgba(0,0,0,.025));
  animation: shake .1s linear infinite;
}

.exhaust {
  opacity: 1 !important;
  bottom: 0 !important;
}
              
            
!

JS

              
                const rocket = document.querySelector('#rocket')
const sky = document.querySelector('#sky')
const ex = document.querySelector('#exhaust')
var bottom = 0
var last_y = 0
var wheel;

window.addEventListener('wheel', function(e){
  wheel = e.deltaY
})

window.addEventListener('scroll', function(e){
  var h = window.innerHeight
  var y = document.documentElement.scrollTop
  var doc = document.body.offsetHeight - 250
  var perc = y / (doc - h)
  // console.log(perc)

  if(perc < 1){
    sky.style.bottom = -1*(perc)*100 + '%'    
  }  

  if(perc > 0) {
    rocket.classList.add('shake_rocket')
    ex.classList.add('exhaust')
  } else {
    rocket.classList.remove('shake_rocket')
    ex.classList.remove('exhaust')
  }
  
  if(perc > .37) {
    ex.classList.remove('exhaust')
  }

  if(perc > .25) {
    bottom = (perc - .25)*133
  }
  
  if(perc > 0) {
    bottom = (perc - .25)*133
    if(perc - .25 < 0) {
      bottom = 0
    }
  }
  rocket.style.bottom = bottom + '%'

  last_y = y
})
              
            
!
999px

Console