css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

<div id="starwars" class="animate">
  <p class="intro">
    A long time ago, in a galaxy far, far away... 
  </p>
  <img src="http://vignette1.wikia.nocookie.net/disney/images/8/8b/Starwars-logo.png" class="logo" />
  <div id="reel">
    <div class="content">
      <h1>Episode IV</h1>
      <h2>A NEW HOPE</h2>
      <p>It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.</p>

      <p>During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR, an armored space station with enough power to destroy an entire planet.</p>

      <p>Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy....</p>
    </div>
  </div>
  
  <audio src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/244725/MainTitle.ogg" onloadeddata="var audioPlayer = this; setTimeout(function() { audioPlayer.play(); }, 4500)">
  </audio>
  
  <button>Restart</button>
</div>
            
          
!
            
              html {
  height: 100%;
}
body {
  background: url(https://i.ytimg.com/vi/JquobII5VjA/maxresdefault.jpg);
  background-size: cover;
  position: relative;
  height: 100%;
  font-family: 'Open Sans', sans serif;
}

#starwars {
  position: relative;
  height: 100%;
  width: 100%;
}

.animate {
  .intro {
    font-size: 250%;
    color: #19A3C8;
    width: 578px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: intro 5s linear 0s;
    opacity: 0;
  }

  .logo {
    position: absolute;
    width: 0;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: logo  10s linear 5s;
    opacity: 0;
  }

  #reel {
    $width: 580px;
    width: $width;
    margin-left: -($width/ 2);

    position: absolute;
    bottom: 0;
    left: 50%;
    height: 100em;
    overflow: hidden;

    transform: perspective(255px) rotateX(30deg);
    transform-origin: 50% 100%;

    color: #FFEC01;
    font-weight: bold;
    font-size: 250%;
    text-align: justify;

    div {
      position: absolute;
      top: 100%;
      animation: reel 53s linear 12s;

      p {
        line-height: 1.5em;
        margin-top: 50px;

        &:first-child {
          margin-top: 0;
        }
      }

      h1, h2 {
        text-align: center;
        margin-bottom: 25px;
      }
    }
  }
  
  button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
    background: none;
    border: 0;
    font-weight: bold;
    color: #FFEC01;
    opacity: 1;
    cursor: pointer;
    animation: reset  66s linear;
  }
}

@keyframes reel {
	0% { 
    top: 100%; 
    opacity: 1;
  }
  95% {
    opacity: 1;
  }
	100% { 
    top: 50%; 
    opacity: 0;
  }
}

@keyframes intro {
	0% { 
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
	80% { 
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes logo {
	0% { 
    width: 300px;
    opacity: 1;
  }
  10% {
    width: 300px;
    opacity: 1;
  }
  15% {
    width: 300px;
  }
	90% {
    width: 10px;
    opacity: 1;
  }
  100% {
    width: 0;
    opacity: 0;
  }
}

@keyframes reset {
  0% {
    opacity: 0;
    cursor: default;
  }
  99% {
    opacity: 0;
    cursor: default;
  }
  100% {
    opacity: 1;
    display: block;
  }
}
            
          
!
            
              $(function() {
  $('button').on('click', function() {
    var elm = document.getElementById('starwars');
    var newone = elm.cloneNode(true);
    elm.parentNode.replaceChild(newone, elm);
  });
}());
            
          
!
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.
Loading ..................

Console