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.

            
              #app
  .text-wrapper
    .text.part1
      anim-word(v-bind:text="word1"  @poof="rem") 

    .text.part2
      anim-word(v-bind:text="word2" @poof="rem")

    .how-to 
      span(v-if="clickTimes === 0") Just click a letter...
      span(v-else-if="clickTimes >= 5 && clickTimes < totalLetters") Hahahahaaaa! Click em all!!
      span(v-else-if="clickTimes >= totalLetters") Yay you did it! You did it!!
      span(v-else) Keep going... 

    //- pre {{ $data }}
  .reset(@click="back")
    svg(viewBox="0 0 32 32" width="32" height="32" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2")
      path(d="M29 16 C29 22 24 29 16 29 8 29 3 22 3 16 3 10 8 3 16 3 21 3 25 6 27 9 M20 10 L27 9 28 2") 



            
          
!
            
              // TYPOGRAFY
@import url('https://fonts.googleapis.com/css?family=Fredoka+One|Open+Sans:300');
$main-font: 'Fredoka One', cursive;
$size: 8em;
$overlapping: -14px;
$opacity: .65;
$sec-font: 'Opens Sans', sans-serif;

// COLORS
$white: #fff;
$black: #000;
$palette: #4e2a84 #ff5a5f #f99b0c #cee007 #00c6b2;
$palette_length: length($palette);

// SETTING
$word_1_length: 6;
$word_2_length: 9;
$counter: 1;
$speed: 1.2s;
$rand_rotation: 600;
$timing_count: ($word_1_length * 1) + 1;


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

body{
  font-family: $main-font;
  font-size: 16px;
}


// TEXT STYLES
#app{
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: rgba(#000, .9);
  overflow: hidden;
}

.text-wrapper{
  padding: 0 1rem;
  max-width: 50rem;
  width: 100%;
  text-align: center;
}

.text{
  font-size: $size;
  text-transform: uppercase;
  letter-spacing: $overlapping;
  .letter{
    position: relative;
    display: inline-block;
    transition: all .4s;
    .character{
      opacity: $opacity;
      transition: color .4s;
      cursor: pointer;
    }
    span{
      position: absolute;
      bottom: .8rem;
      left: .4rem;
      display: block;
      width: 100%;
      height: 15px;
      &::before{
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        transform: translate(-50%, -50%);
        border-radius: 50%;
        background: rgba($black, .25);
      }
    }
    &:hover{
      .character{
        color: #fff !important;
      }
    }
  }
  &.part1{
    .letter{
      @for $i from 1 through $word_1_length{
        @if $counter > $palette_length{
          $counter: 1;
        }
        &:nth-child(#{$i}) {
          $timing: $i / 3;
          // Random anim
          $randRot: random($rand_rotation);
          &.poofed{
            transform-origin: 50% 50%;
            animation: poofing#{$i} 1.4s ease-in-out infinite alternate; 
          }
          @keyframes poofing#{$i}{
            0%{
              transform: rotateZ(0deg) rotateY(0) translateY(0px)  scale(1);
            }
            50%{
              transform: rotateZ(0deg) rotateY(360deg) translateY(0px) scale(1);
            }
            56%{
              transform: rotateZ( $randRot + 0deg) rotateY(360deg) translateY(0px) scale(1);
            }
            100%{
              transform: rotateZ( $randRot + 0deg) rotateY(360deg) translateY(-700px) scale(0.01); 
            }
          }
          .character{
            color: nth($palette, $counter);
            animation: wave $speed linear infinite;
            animation-delay: #{$timing}s;
          }
          span::before{
            animation: shadow $speed linear infinite;
            animation-delay: #{$timing}s;
          }
        }
        $counter: $counter + 1;
      }
    }
  }
  &.part2{
    span{
      $counter: $counter + ($word_1_length - $palette_length);
      @for $i from 1 through $word_2_length{
        @if $counter > $palette_length{
          $counter: 1;
        }
        &:nth-child(#{$i}) {
          $timing: $timing_count / 3;
          // Random anim
          $randRot: random($rand_rotation);
          &.poofed{
            animation: sec_poofing#{$i} 1.4s ease-in-out infinite alternate; 
          }
          @keyframes sec_poofing#{$i}{
            0%{
              transform: rotateZ(0deg) rotateY(0) translateY(0px)  scale(1);
            }
            50%{
              transform: rotateZ(0deg) rotateY(360deg) translateY(0px) scale(1);
            }
            56%{
              transform: rotateZ( $randRot + 0deg) rotateY(360deg) translateY(0px) scale(1);
            }
            100%{
              transform: rotateZ( $randRot + 0deg) rotateY(360deg) translateY(-700px) scale(0.01); 
            }
          }
          .character{
            color: nth($palette, $counter);
            animation: wave $speed linear infinite;
            animation-delay: #{$timing}s;
          }
          span::before{
            animation: shadow $speed linear infinite;
            animation-delay: #{$timing}s;
          }
        }
        $counter: $counter + 1;
        $timing_count: $timing_count + 1;
      }
    }
  }
}

@keyframes wave{
  0%{
    transform: translateY(0); 
  }
  50%{
    transform: translateY(-10px); 
  }
  100%{
    transform: translateY(0); 
  }
}
@keyframes shadow{
  0%{
    width: 0;
    height: 0;
  } 
  50%{
    width: 100%;
    height: 100%;
  }
  100%{
    width: 0;
    height: 0;
  }
}


.how-to{
  margin: 2rem 0 2rem 1rem;
  font-family: $sec-font;
  font-weight: 300;
  font-size: .85em;
  letter-spacing: 4px;
  color: rgba($white, .6);
}

.reset{
  position: absolute;
  bottom: 0;
  right: 0;
  padding: .5rem;
  font-family: $sec-font;
  font-weight: 300;
  font-size: .85em;
  color: rgba($white, .4);
  cursor: pointer;
  border: 1px solid rgba($white, .3);
  border-right: none;
  border-bottom: none;
  transition: color .4s;
  svg{
    display: block;
    transform: scale(.7);
    transform-origin: center center;
  }
  &:hover{
    color: rgba($white, .8);
    svg{
      animation: rotate 1s linear infinite;
    }
  }
}

@keyframes rotate{
  0%{
    transform: rotateZ(0) scale(.7);
  }
  100%{
    transform: rotateZ(360deg) scale(.7);
  }
}


// RESPONSIVE
@media only screen and (max-width: 767px){
  .text{
    font-size: 6em;
    .letter{
      span{
        bottom: .5rem;
      }
    }
  }
}
@media only screen and (max-width: 480px){
  .text{
    font-size: 4em;
    .letter{
      span{
        bottom: 0;
      }
    }
  }
}
            
          
!
            
              Vue.component('anim-word', { 
  props: ['text'],
  template: `
  <div>
    <span class="letter" v-for="(letter, index) in text.letters" 
      @click="$emit('poof', text.id, letter.char)"
      v-bind:class="{ poofed: !letter.alive }"
    >
      <div class="character">{{ letter.char }}</div> 
      <span></span>
    </span>
  </div>
  ` 
});



new Vue({
  el: '#app',
  data: {
    clickTimes: 0,
    word1: {
      id: 1,
      letters: [
        { char:'c', alive: true },
        { char:'o', alive: true },
        { char:'d', alive: true },
        { char:'i', alive: true },
        { char:'n', alive: true },
        { char:'g', alive: true }
      ]
    },
    word2: {
      id: 2,
      letters: [
        { char: 'd', alive: true },
        { char: 'e', alive: true },
        { char: 'l', alive: true },
        { char: 'i', alive: true },
        { char: 'r', alive: true },
        { char: 'i', alive: true },
        { char: 'u', alive: true },
        { char: 'm', alive: true }
      ]
    },
    totalLetters: 0
  },
  mounted(){
    this.totalLetters = this.word1.letters.length + this.word2.letters.length; 
  },
  methods: {
    rem(id, letter){
      // update text
      if(! this.clicked){
        this.clickTimes++;
      }
      
      // word 1
      if(id === 1){
        this.word1.letters = this.word1.letters.map(function(item){
          if(item.char == letter){
            item.alive = false;
          }
          return item;
        });
      }
      // word 2
      else if (id === 2){
        this.word2.letters = this.word2.letters.map(function(item){
          if(item.char === letter && item.alive !== false){
            item.alive = false;
            letter= null;
          }
          return item;
        });
      }
    },
    
    back(){
      // Reset text
      this.clickTimes = 0;
      
      // Restore letter position
      this.word1.letters = this.word1.letters.map(function(item){
        item.alive = true; 
        return item;
      });
      this.word2.letters = this.word2.letters.map(function(item){
        item.alive = true; 
        return item;
      });
      
    }
  }
})
            
          
!
999px
Loading ..................

Console