cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="input-wrap">
  <input type="text" id="text" placeholder="Type Here"/>
</div>
<div class="throw">
</div>
            
          
!
            
              html,body {
  height: 100%;
}
body {
  background: linear-gradient(180deg, #000 0%, #333 100%);
  font-family:'Open Sans', sans-serif;
}
.input-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content:center;
  
  input {
    background: rgba(255,255,255,0);
    border: 1px solid rgba(255,255,255,0.6);
    font-size: 1.5em;
    color: #fff;
    padding: 0.5em 0.75em;
    border-radius: 4px;
    width: 50vw;
    font-weight:400;
    transition: all ease 150ms;
    
    &:focus {
      outline: 0;
      background: rgba(255,255,255,.1)
    }
    
    &::placeholder {
      color: rgba(255,255,255,0.2);
    }
  }
}

.throw {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index:-1;
  font-weight:700;
  overflow: hidden;
  
  span {
    font-size:3em;
    color: #fff;
    position: absolute;
    bottom:-10%;
    left: 0;
    
    @for $i from 1 through 200 {
      $red: random(256)-1;
      $green: random(256)-1;
      $blue: random(256)-1;
      &:nth-of-type(#{$i}){
        color: rgb($red, $green, $blue);
      }
    }
    
    &.an-1 {
     animation: throw-1-up 1200ms ease-out forwards, throw-1-down 750ms 1200ms ease-in forwards; 
    }
    &.an-2 {
      animation: throw-2-up 900ms ease-out forwards, throw-2-down 450ms 900ms ease-in forwards;
    }
    &.an-3 {
      animation: throw-3-up 1300ms ease-out forwards, throw-3-down 1300ms 1300ms ease-in forwards;
    }
    
    &.an-4 {
      animation: throw-4-up 1380ms ease-out forwards, throw-4-down 1130ms 1380ms ease-in forwards;
    }
    
    &.an-5 {
      animation: throw-5-up 830ms ease-out forwards, throw-5-down 660ms 830ms ease-in forwards;
    }
    
    &.an-6 {
      animation: throw-6-up 320ms ease-out forwards, throw-6-down 940ms 320ms ease-in forwards;
    }
  }
}

@keyframes throw-1-up {
  0% {
    transform: translateY(0%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(-500%) rotateX(300deg) rotateY(-220deg) rotateZ(760deg);
  }
}

@keyframes throw-1-down {
  0% {
    transform: translateY(-500%) rotateX(300deg) rotateY(-220deg) rotateZ(760deg);
  }
  100% {
    transform: translateY(0%);
  }
}

@keyframes throw-2-up {
  0% {
    transform: translateY(0%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(-300%) rotateX(-120deg) rotateY(120deg) rotateZ(160deg);
  }
}

@keyframes throw-2-down {
  0% {
    transform: translateY(-300%) rotateX(-120deg) rotateY(120deg) rotateZ(160deg);
  }
  100% {
    transform: translateY(0%)
  }
}

@keyframes throw-3-up {
  0% {
    transform: translateY(0%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(-800%) rotateX(174deg) rotateY(120deg) rotateZ(450deg);
  }
}

@keyframes throw-3-down {
  0% {
    transform: translateY(-800%) rotateX(174deg) rotateY(120deg) rotateZ(450deg);
  }
  100% {
    transform: translateY(0%);
  }
}

@keyframes throw-4-up {
  0% {
    transform: translateY(0%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(-850%) rotateX(323deg) rotateY(-120deg) rotateZ(-450deg);
  }
}

@keyframes throw-4-down {
  0% {
    transform: translateY(-850%) rotateX(323deg) rotateY(-120deg) rotateZ(-450deg);
  }
  100% {
    transform: translateY(0%);
  }
}

@keyframes throw-5-up {
  0% {
    transform: translateY(0%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(-350%) rotateX(-23deg) rotateY(-210deg) rotateZ(50deg);
  }
}

@keyframes throw-5-down {
  0% {
    transform: translateY(-350%) rotateX(-23deg) rotateY(-210deg) rotateZ(50deg);
  }
  100% {
    transform: translateY(0%);
  }
}

@keyframes throw-6-up {
  0% {
    transform: translateY(0%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(-523%) rotateX(32deg) rotateY(152deg) rotateZ(87deg);
  }
}

@keyframes throw-6-down {
  0% {
    transform: translateY(-523%) rotateX(32deg) rotateY(152deg) rotateZ(87deg);
  }
  100% {
    transform: translateY(0%);
  }
}
            
          
!
            
              var globalCounter = 1;
var screenEdge = window.innerWidth - 50;
var keyPressed = false;

$(function(){
  init();
  bindKeyEvents();
  setInterval(function(){
    if (keyPressed){
      var value = $('#text').val();
      var lastLetter = value.substr(value.length - 1);
      createLetter(lastLetter);
    }
  },50); // Throttle
});

function init(){
  var firstLoad = "ABcDEfGhIJkLMnOPqRSTUvwXyZ".split('');
  var count = 0;
  var timer = setInterval(function(){
    if (count < firstLoad.length){
      createLetter(firstLoad[count]);
      count++; 
    } else {
      clearInterval(timer);
      $('#text').focus();
    }
  }, getRand(10,50) );
}

function bindKeyEvents(){
  $('#text').on('keydown',function(){
    keyPressed = true;
  });
  $('#text').on('keyup',function(){
    keyPressed = false;
  });
}

function unbindKeyEvents(){
  $('#text').unbind('keyup');
  $('#text').unbind('keydown');
}

function getRand(min,max) {
    return Math.floor(Math.random()*(max-min+1)+min);
}

function createLetter(val){
  var newSpan = '<span id=letter-"'+globalCounter+'" class="an-'+getRand(1,6)+'" style="left:'+getRand(50,screenEdge)+'px">'+val+'</span>';
  $('.throw').append(newSpan);  
  globalCounter++;
  
  if (globalCounter > 200){ // this is 💩 soultion.
    unbindKeyEvents();
    setTimeout(function(){
      $('.throw').empty();
      bindKeyEvents();
      globalCounter = 1;
    },2000);
  }
}
            
          
!
999px
Loading ..................

Console