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.

            
              <!--
Original effect: https://imgur.com/JlXS1Em/

For the full effect download the "Felix Titling" font: https://www.myfonts.com/fonts/mti/felix-titling/
 
*Whisper*: If you google around, you can save $35 so you can view this pen in its fully glory (but of course if you plan to use this font for a project PLEASE purchase and support its designer!)

This also uses Helvetica Neue, but I'll just assume you have it installed already.
-->

<div class="title-wrapper">
  <div class="title">
    <h2>- Part III -</h2>
    <div class="hr"></div>
    <h1>Blackwater Park</h1>
  </div>
</div>

<a class="toggle"></a>

<!--
Radial Blur Concept Credit:
Vincent de Oliveira (@iamvdo)
https://codepen.io/iamvdo/pen/xECmI
-->

            
          
!
            
              $bg-color: #000;
$fg-color: #fff;
$fg-accent: #f00;
$duration: 5s;
$small-scale: 0.925;
$original-spacing: .1em;
$final-spacing: .3em;
$blur-amount: 0.04em;
$blur-radius: 10%;

// Credit: http://thesassway.com/intermediate/mixins-for-semi-transparent-colors
@function mix-alpha($color, $background) {
  $percent: alpha($color) * 100%;
  $opaque: opacify($color, 1);
  @return mix($opaque, $background, $percent);
}

body {
  background-color: $bg-color;
  font-size: 15vh;
}

.title-wrapper {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateZ(0);
  text-align: center;
  width: 100%;
  user-select: none;
}

.title {
  display: inline-block;
  mask: radial-gradient(closest-side at center, black $blur-radius, transparent 100%);
  
  h2,
  h1 {
    color: $fg-color;
    font: normal 1em/120% 'Felix Titling', serif;
    margin: 0.1em 0.75em;
    text-align: center;
    text-transform: uppercase;
  }
  
  h2 {
    margin-top: 0;
  }
  
  h1 {
    font-size: 1.25em;
    margin-bottom: 0;
  }
  
  .hr {
    background: linear-gradient(to right,
      mix-alpha(rgba($fg-accent, 0), $bg-color) 0%,
      mix-alpha(rgba($fg-accent, .30), $bg-color) 2.5%,
      mix-alpha(rgba($fg-accent, .60), $bg-color) 10%,
      mix-alpha(rgba($fg-accent, .60), $bg-color) 90%,
      mix-alpha(rgba($fg-accent, .30), $bg-color) 97.5%,
      mix-alpha(rgba($fg-accent, 0), $bg-color) 100%
    );
    height: 3px;
    width: 100%;
  }
}

.logo .title {
  h2 {
    font-size: 1.5em;
    margin-bottom: 0em;
  }
  
  h1 {
    color: $fg-accent;
    font-family: 'Helvetica Neue', Helvetica, sans-serif;
    font-size: 0.5em;
    font-weight: 200;
    margin-top: .5em;
  }
}

.title-blurred .title {
  mask: radial-gradient(closest-side at center, transparent $blur-radius, black 100%);
}

@keyframes title-grow {
  0% {
    letter-spacing: $original-spacing;
    transform: scale($small-scale);
    opacity: 0;
  }
  
  10% {
    opacity: 0.8;
  }
  
  100% {
    letter-spacing: $final-spacing;
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes title-unblur {
  0% {
    filter: blur($blur-amount);
  }
  
  100% {
    filter: none;
  }
}

.animate {
  .title {
    animation: title-grow $duration 1 ease-out forwards;
  }
  
  .title-blurred .title {
    animation: title-grow $duration 1 ease-out forwards,
      title-unblur $duration ease-out 1 forwards;
  }
}

.paused {
  .title,
  .title-blurred {
    animation-play-state: paused;
  }
}

.toggle {
  background: rgba(#fff, 0.1);
  border: 1px solid #fff;
  border-radius: 5px;
  bottom: 10px;
  color: #fff;
  cursor: pointer;
  display: block;
  font: normal 16px/120% Helvetica, sans-serif;
  padding: 0.5em;
  position: absolute;
  right: 10px;
  
  &,
  &:visited {
    opacity: 0.5;
  }
  
  &:hover {
    opacity: 0.75;
  }
  
  &:active {
    opacity: 1;
  }
}

            
          
!
            
              /*
 * CLICK ANYWHERE IN THE PEN TO RESTART ANIMATION!
 */
$(function() {
  
  var $title = $('.title-wrapper'),
      $body  = $('body');
  
  // Insert duplicate directly on top to fake a
  // radial blur
  $title.clone().addClass('title-blurred').insertAfter($title);
  
  // Click to restart
  $body.bind('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function() {
        
    $('html').one('click', function() {  
      
      $body.addClass('paused').removeClass('animate');
      $body[0].offsetHeight;
      $body.removeClass('paused').addClass('animate');
      
    });
  });
  
  // Logo/Level title toggle
  var $toggle = $('.toggle')
  
  $toggle.click(function(e) {
    
    e.preventDefault();
    
    $body.toggleClass('logo');
    redrawTitle();
  });
  
  var oldH2 = null,
      oldH1 = null;
  
  function redrawTitle() {
    
    if($body.hasClass('logo')) {
      
      oldH2 = $('h2').first().text();
      oldH1 = $('h1').first().text();
      
      setHeaders('Hitman', 'Absolution');
      
      $toggle.text('Toggle Level Title');
      
    } else {
      
      if(oldH2 !== null && oldH1 !== null) {
        
        setHeaders(oldH2, oldH1);
      }
      
      $toggle.text('Toggle Game Logo');
    }
  }
  
  function setHeaders(h2, h1) {
    
    $('h2').text(h2);
    $('h1').text(h1);
  }
  
  redrawTitle();
  
  // Execute contract!
  $body.addClass('animate');
  
});
            
          
!
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