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="svg-wrapper">
  <svg class='svg' height="470" width="300" xmlns="http://www.w3.org/2000/svg">
    <rect class="shape one" height="470" width="300" />
    <rect class="shape two" height="470" width="300" />
    <div class="text">uji</div>
    <div class="subtext">
      <div class="first">2014</div>
      <div class="second">For practice</div>
    </div>
  </svg>
</div>
<div class="svg-wrapper">
  <svg class='svg' height="470" width="300" xmlns="http://www.w3.org/2000/svg">
    <rect class="shape one" height="470" width="300" />
    <rect class="shape two" height="470" width="300" />
    <div class="text">urbs</div>
    <div class="subtext">
      <div class="first">2014</div>
      <div class="second">For practice</div>
    </div>
  </svg>
</div>
            
          
!
            
              html, body {
  background: rgb(20,20,20);
  text-align: center;
  height: 100%;
  overflow: hidden;
}
.svg-wrapper {
  background:#BFBFC2;
  position: relative;
  height:470px;
  top:50%;
  transform: translateY(-50%);	
  display:inline-block;
  margin-right:30px;
  margin-left:30px;
  width: 300px;  
}
.svg { box-shadow: inset 0px 0px 0px 3px rgb(20,20,20); }
.shape {  
  stroke-width: 2px;
  fill: transparent;
  stroke: #EAEAEA;
  transition: fill .6s;
}
.one { stroke-dasharray: 470 300 470 300; stroke-dashoffset: 470; }
.two { stroke-dasharray: 300 470 300 470; }
.text {
  font-family: 'Roboto Condensed';
  font-size: 22px;
  line-height: 0px;
  letter-spacing: 8px;
  color: rgb(20,20,20);
  top: -350px;
  position: relative;
  transition:color .6s;
}
.subtext {
  color:#65626b;
  text-transform:uppercase;
  font-family:'Roboto Condensed';
  top: -150px;
  position: relative;
  font-size:9px;
  text-align:left;
  margin-left:50px;
}
.first { margin-bottom:30px; }


            
          
!
            
              // For more check out zachsaucier.com
var si = document.querySelectorAll(".one"),
    to = document.querySelectorAll(".two"),
    te = document.querySelectorAll(".text");

for(var i = 0, j = si.length; i < j; i++) {
  applyEverything(si[i], to[i], te[i]);
}

function applyEverything(sides, topbottom, text) {
  var gparent = sides.parentNode.parentNode;
  
  gparent.onmouseenter = function() {
    sides.style.fill = "rgb(20,20,20)";
    text.style.color = "white";
    console.log("over");
    
    // Originally these made sense... Then reality happened
    TweenLite.to(topbottom, .8, {strokeDasharray:"-130 900 -130 900", strokeDashoffset:20, ease:Power2.linear});
    TweenLite.to(topbottom, .6, {strokeDasharray:"470 300 470 300", strokeDashoffset:470, delay:.3, ease:Power2.linear});
    
    TweenLite.to(sides, .8, {strokeDasharray:"-200 1070 -200 1000", strokeDashoffset:640, ease:Power2.linear});
    TweenLite.to(sides, .6, {strokeDasharray:"300 470 300 470", strokeDashoffset:770, delay:.3, ease:Power2.linear});
    
    setTimeout(function() { // Delay fade when leaving hover
      sides.style.transition = "fill .6s .6s";
      text.style.transition = "color .6s .6s";
    }, 10);
  }  
  
  gparent.onmouseleave = function() {
    sides.style.fill = "transparent";
    text.style.color = "rgb(20,20,20)";
    console.log("out");
    setTimeout(function() {
      sides.style.transition = "fill .6s"; // Reset fade for next hover
      text.style.transition = "color .6s";
    }, 10);
    
    // Originally these made sense... Then reality happened
    TweenLite.to(topbottom, .8, {strokeDasharray:"-130 1050 -130 900", strokeDashoffset:20, ease:Power2.linear});
    TweenLite.to(topbottom, .6, {strokeDasharray:"300 470 300 470", strokeDashoffset:0, delay:.4, ease:Power2.linear});
    
    TweenLite.to(sides, .8, {strokeDasharray:"-200 1335 -200 1000", strokeDashoffset:640, ease:Power2.linear});
    TweenLite.to(sides, .6, {strokeDasharray:"470 300 470 300", strokeDashoffset:470, delay:.4, ease:Power2.linear});
  }
}
            
          
!
999px
Loading ..................

Console