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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <section id="grid" data-path-from="m 0,-0.5337091 200,0 0,86.9148401 c -102.826143,-34.275781 -94.88403,33.170919 -200,0 z" data-path-to="m 0,-0.5337091 200,0 0,45.5189141 c -98.72778,19.754056 -96.52337,-23.611381 -200,0 z" data-fill-color="rgba(255,255,255,0.8)">
  
  <article style="background-image:url('https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLZzlqeXFwMjRYamc');">
    <a href="#">
      <figure>
        <svg viewBox="0 0 200 200"  preserveAspectRatio="none"></svg>
        <figcaption>
          <h2>Article Title 1</h2>
          <p>Lorem ipsum dolor sit amet consectetuer adipiscing elit</p>
        </figcaption>
        <button>Read More</button>
      </figure>
    </a>
  </article>
  
  <article style="background-image:url('https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLdEF1ekdjU3pIeFU');">
    <a href="#">
      <figure>
        <svg viewBox="0 0 200 200"  preserveAspectRatio="none"></svg>
        <figcaption>
          <h2>Article Title 2</h2>
          <p>A collection of textile samples lay spread out 
on the table.</p>
        </figcaption>
        <button>Read More</button>
      </figure>
    </a>
  </article>
  
  <article style="background-image:url('https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLWExUdnkwN24yMHM');">
    <a href="#">
      <figure>
        <svg viewBox="0 0 200 200"  preserveAspectRatio="none"></svg>
        <figcaption>
          <h2>Article Title 3</h2>
          <p>Samsa was a travelling salesman.</p>

        </figcaption>
        <button>Read More</button>
      </figure>
    </a>
  </article>
  
  <article style="background-image:url('https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLWjVkRWNDOXFBeHc');">
    <a href="#">
      <figure>
        <svg viewBox="0 0 200 200"  preserveAspectRatio="none"></svg>
        <figcaption>
          <h2>Article Title 4</h2>
          <p>Donec pede justo fringilla vel aliquet nec vulputate eget arcu</p>
        </figcaption>
        <button>Read More</button>
      </figure>
    </a>
  </article>
  
  <article style="background-image:url('https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLR0xDU1BBR2h6Mzg');">
    <a href="#">
      <figure>
        <svg viewBox="0 0 200 200"  preserveAspectRatio="none"></svg>
        <figcaption>
          <h2>Article Title 5</h2>
          <p>In enim justo rhoncus ut imperdiet a venenatis vitae justo</p>
        </figcaption>
        <button>Read More</button>
      </figure>
    </a>
  </article>
  
  <article style="background-image:url('https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLa3VscHBocThYUXc');">
    <a href="#">
      <figure>
        <svg viewBox="0 0 200 200"  preserveAspectRatio="none"></svg>
        <figcaption>
          <h2>Article Title 6</h2>
          <p>The bedding was hardly able to cover it.</p>
        </figcaption>
        <button>Read More</button>
      </figure>
    </a>
  </article>
</section>

              
            
!

CSS

              
                // ******************************
// Normalize (ignore me!)
// ******************************
$bg_color:#333;
$fonts:Lato,Arial,"Hiragino Kaku Gothic Pro W3",Meiryo,sans-serif;
$font_color:#ccc;
$link_color:#ccc;
$link_hover_color:#aaa;

%bv_hidden{
	backface-visibility: hidden;
}

*, *:before, *:after{
  box-sizing:border-box;
  padding:0;
  margin:0;
}
body{
  font-family:$fonts;
  background-color:$bg_color;
  position:relative;
  color: $font_color;
  text-align: center;
  a, a:visited{
    color: $link_color;
    text-decoration:none;
  }
  a:hover{
    color: $link_hover_color;
  }
}
// ******************************
// End of Normalize
// ******************************

// SVG morphing style
#grid {
	margin:0 auto;
  letter-spacing:-1em;  // To fix the item margin
  article {
    position:relative;
    display: inline-block;
    min-width:280px;
    width: 33.333vw;
    height: 500px;
    background-position:center;
    background-size:cover;
    letter-spacing:normal;  // Reset
  
    &:before {
      content:'';
      position:absolute;
      top:0;
      left:0;
      width:100%;
      height:100%;
      background-color:#000;
      opacity:0.32;
      transition: all 0.3s;
    }
    
    &:hover {
      &:before{
        opacity:0;
      }
      figcaption {
        h2, p {
          transform: translateY(0);
        }
        p {
          opacity: 0;
        }
      }
      button{
        transform:scale(1);
      }
    }
  }
  
  figure {
    position: relative;
    overflow: hidden;
    width:100%;
    height:100%;
    
    button {
      position: relative;
      top:48%;
      padding:10px 15px;
      color:#fff;
      letter-spacing:0.1em;
      border:3px solid;
      text-shadow:0 0 12px rgba(#000,0.6);
      box-shadow:0 0 12px rgba(#000,0.2), 0 0 12px rgba(#000,0.2) inset;
      background-color:transparent;
      transition: all 0.3s ease 0.15s;
      transform:scale(0);
      @extend %bv_hidden;
    }
  }
  
  figcaption {
    position: absolute;
    top: 0;
    z-index: 11;
    padding: 10px;
    width: 100%;
    height: 100%;
    text-align: center;
    @extend %bv_hidden;
    
    h2 {
      margin:20px auto 5%;
      color: #5a5a5a;
      letter-spacing: 1px;
      font-size: 130%;
      transition: all 0.4s cubic-bezier(0.250, 0.250, 0.115, 1.445);
    }
    
    p {
      padding: 0 10%;
      color:#888;
      font-size:14px;
      transition: all 0.3s ease;
    }
    
    h2, p {
      transform: translateY(40px);
      @extend %bv_hidden;
    }
  }
  
  svg {
    position: absolute;
    top: -1px; // fixes rendering issue in FF
    left:0;
    z-index: 10;
    width: 100%;
    height: 100%;
    
    path {
      // fill: rgba(#fff,1);
    }
  }
}
              
            
!

JS

              
                (function() {
  var duration = 400,
      easing = mina.backout,
      grid = document.querySelector("#grid"),
      items = document.querySelectorAll("#grid article"),
      is_hover = false;
  
  if (items.length) {
    var path_config = {
          from : grid.getAttribute('data-path-from'),
          to : grid.getAttribute('data-path-to'),
          fill_color : grid.getAttribute('data-fill-color')
        };

    // Sets and morph svg with each article
    [].slice.call(items).forEach(function(el) {
			var snap = Snap(el.querySelector('svg')),
          // Draw svg with path
          path_svg = snap.path(path_config.from).attr({
            fill: path_config.fill_color
          });

      // On mouse over
			el.addEventListener('mouseenter', function() {
        if (!is_hover) {
          // Morph
          path_svg.animate( 
            {'path' : path_config.to}, 
            duration, 
            easing);
          is_hover = true;
        }
			});

      // On mouse leave
			el.addEventListener( 'mouseleave', function() {
        if (is_hover) {
          // Morph
          path_svg.animate(
            {'path' : path_config.from}, 
            duration, 
            easing );
          is_hover = false; 
        }
			});
		});
  }
})();
              
            
!
999px

Console