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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                doctype html
html(lang="en")
  head
    title= "Text-reveal animation"
    meta(charset='utf-8')
    meta(name="viewport" content="width=device-width")
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet">
  body
    #buttons
      button#refresh Run again
      a.postlink(href="https://codepen.io/owlypixel/post/text-reveal-animation-tutorial") Read the post
    #app
      .ui-slide-in
        .text-wrapper
          .line #[span.black Snowshoe hares,] #[span.black.yellow fast] #[span.thin on the]
          .line ground #[span.thin and] #[span.yellow rapid breeders] ...
              
            
!

CSS

              
                $bg-black: #000000;
$yellow: #FFCA00;

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

*, *:before, *:after {
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: left;
    background: url(https://raw.githubusercontent.com/owlypixel/Text_reveal_animation/master/Project-snapshots/1-starter/images/rabbit_bg.png);
    background-size: cover;
    font: 36px/1.2 'Open Sans', sans-serif;
}
#app {
    position: relative;
    &:after {
        display: block;
        content: '';
        position: absolute;
        border-left: 10px solid $yellow;
        left: 1.528em;
        top: 50%;
        width: 0.278em;
        height: 60%;
        transform: translateY(-50%) scaleY(0) ;  
        animation: left-border-expand .8s;
        animation-fill-mode: forwards;
        transform-origin: 50% 50%;
    }
}
.ui-slide-in {
    width: 720px;
    height: 126px;
    background-color: rgba($bg-black, .6);
    box-shadow: 0 .2em 1em rgba($bg-black, .3);
    color: #fff;
    padding: 20px 20px 20px 65px;
    animation: ui-slide-in-move 1.25s;
    animation-timing-function: cubic-bezier(.03, .98, .5, 1);
    transform-origin: left center;
    .text-wrapper {
        text-transform: uppercase;
        padding-left: 0.556em;
        overflow: hidden;
    }
}
.line {
    opacity: 0;
    animation: word-line-slide-out .25s forwards;
    animation-timing-function: ease-out;
    @for $i from 1 through 2 {
        $time: ($i * .25) + .25;
        &:nth-child(#{$i}n) {
            animation-delay: #{$time}s;
        }
    }
    span {
        display: inline-block;
        height: 43.2px;
    }
}
.yellow {
    color: $yellow;
}
.black {
    font-weight: 800;
}
.thin {
    font-weight: 300;
}

@keyframes ui-slide-in-move {
    0% {transform: scaleX(0);}
    100% {transform: scaleX(100%);}
}
@keyframes left-border-expand {
    100% {transform: translateY(-50%) scaleY(1);}
}
@keyframes word-line-slide-out {
    0% {
        transform: translateX(-10vw);
        opacity: 0;
    }
    100% {
        transform: translateX(0vw);
        opacity: 1;
    }
}

// --------Refresh button-----------
#buttons {
  display: flex;
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translatex(-50%);
  .postlink {
    display: inline-block;
    text-align: center;
    border-color: #3E82E6;
    &:hover {
      border-color: $yellow;
    }
  }
}
#refresh, .postlink {
  width: 250px;
  height: 70px;
  margin: 10px;
  font-size: 22px;
  border: 3px solid #28F2B3;
  color: white;
  line-height: 64px;
  background: none;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 0 5px #222;
  border-radius: 70px;
  outline: none;
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: bold;
  transition: all .3s;
  &:hover {
    border-color: $yellow;
  }
}
              
            
!

JS

              
                // this is a simple hack to restart css animation

var refresh_button = document.querySelector("#refresh");
refresh_button.addEventListener('click', function(){
  var app = document.querySelector("#app");
  var newone = app.cloneNode(true);
  app.parentNode.replaceChild(newone, app);
})
              
            
!
999px

Console