Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <!DOCTYPE html>
  2. <html lang="en" class="demo-1 no-js" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
  3.     <head>
  4.         <meta charset="UTF-8" />
  5.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.         <meta name="viewport" content="width=device-width, initial-scale=1">
  7.         <title></title>
  8.         <meta name="description" content="Hover Effects with animated SVG Shapes using Snap.svg" />
  9.         <meta name="keywords" content="animated svg, hover effect, grid, svg shape html, " />
  10.         <meta name="author" content="Codrops" />
  11.         <link rel="shortcut icon" href="../favicon.ico">
  12.         <link rel="stylesheet" type="text/css" href="css/normalize.css" />
  13.         <link rel="stylesheet" type="text/css" href="css/demo.css" />
  14.         <link rel="stylesheet" type="text/css" href="css/component.css" />
  15.         <script src="js/snap.svg-min.js"></script>
  16.         <!--[if IE]>
  17.         <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  18.         <![endif]-->
  19.    
  20. <!--[if gte mso 9]><xml>
  21. <mso:CustomDocumentProperties>
  22. <mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_Editor msdt:dt="string">Everyone</mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_Editor>
  23. <mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_Author msdt:dt="string">Everyone</mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_Author>
  24. </mso:CustomDocumentProperties>
  25. </xml><![endif]-->
  26. </head>
  27.     <body>
  28.         <div class="container">
  29.             <!-- Top Navigation -->
  30.             <div class="codrops-top clearfix">
  31.                 <a class="codrops-icon codrops-icon-prev" href="http://tympanus.net/Development/SVGDrawingAnimation/"><span>Previous Demo</span></a>
  32.                 <span class="right"><a href="http://cargocollective.com/isaac317">Artwork by Isaac Montemayor</a><a class="codrops-icon codrops-icon-drop" href="http://tympanus.net/codrops/?p=18145"><span>Back to the Codrops Article</span></a></span>
  33.             </div>
  34.             <header class="codrops-header">
  35.                 <h1>Shape Hover Effect with SVG<span>Recreating the effect as seen on <a href="http://christmasexperiments.com/">The Christmas Experiments</a></span></h1> 
  36.                 <nav class="codrops-demos">
  37.                     <a class="current-demo" href="index.html">Demo 1</a>
  38.                     <a href="index2.html">Demo 2</a>
  39.                     <a href="index3.html">Demo 3</a>
  40.                 </nav>
  41.             </header>
  42.             <section id="grid" class="grid clearfix">
  43.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  44.                     <figure>
  45.                         <img src="img/1.png" />
  46.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  47.                         <figcaption>
  48.                             <h2>Crystalline</h2>
  49.                             <p>Soko radicchio bunya nuts gram dulse.</p>
  50.                             <button>View</button>
  51.                         </figcaption>
  52.                     </figure>
  53.                 </a>
  54.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  55.                     <figure>
  56.                         <img src="img/3.png" />
  57.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  58.                         <figcaption>
  59.                             <h2>Cacophony</h2>
  60.                             <p>Two greens tigernut soybean radish.</p>
  61.                             <button>View</button>
  62.                         </figcaption>
  63.                     </figure>
  64.                 </a>
  65.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  66.                     <figure>
  67.                         <img src="img/5.png" />
  68.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  69.                         <figcaption>
  70.                             <h2>Languid</h2>
  71.                             <p>Beetroot water spinach okra water.</p>
  72.                             <button>View</button>
  73.                         </figcaption>
  74.                     </figure>
  75.                 </a>
  76.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  77.                     <figure>
  78.                         <img src="img/7.png" />
  79.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  80.                         <figcaption>
  81.                             <h2>Serene</h2>
  82.                             <p>Water spinach arugula pea tatsoi.</p>
  83.                             <button>View</button>
  84.                         </figcaption>
  85.                     </figure>
  86.                 </a>
  87.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  88.                     <figure>
  89.                         <img src="img/2.png" />
  90.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  91.                         <figcaption>
  92.                             <h2>Nebulous</h2>
  93.                             <p>Pea horseradish azuki bean lettuce.</p>
  94.                             <button>View</button>
  95.                         </figcaption>
  96.                     </figure>
  97.                 </a>
  98.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  99.                     <figure>
  100.                         <img src="img/4.png" />
  101.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  102.                         <figcaption>
  103.                             <h2>Iridescent</h2>
  104.                             <p>A grape silver beet watercress potato.</p>
  105.                             <button>View</button>
  106.                         </figcaption>
  107.                     </figure>
  108.                 </a>
  109.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  110.                     <figure>
  111.                         <img src="img/6.png" />
  112.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  113.                         <figcaption>
  114.                             <h2>Resonant</h2>
  115.                             <p>Chickweed okra pea winter purslane.</p>
  116.                             <button>View</button>
  117.                         </figcaption>
  118.                     </figure>
  119.                 </a>
  120.                 <a href="#" data-path-hover="m 180,34.57627 -180,0 L 0,0 180,0 z">
  121.                     <figure>
  122.                         <img src="img/8.png" />
  123.                         <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="M 180,160 0,218 0,0 180,0 z"/></svg>
  124.                         <figcaption>
  125.                             <h2>Zenith</h2>
  126.                             <p>Salsify taro catsear garlic gram.</p>
  127.                             <button>View</button>
  128.                         </figcaption>
  129.                     </figure>
  130.                 </a>
  131.             </section>
  132.             <section class="related">
  133.                 <p>If you enjoyed these effects you might also like:</p>
  134.                 <div><a href="http://tympanus.net/Tutorials/CaptionHoverEffects/"><h4>Caption Hover Effects</h4></a></div>
  135.                 <div><a href="http://tympanus.net/Development/AnimatedSVGIcons/"><h4>Animated SVG Icons</h4></a></div>
  136.             </section>
  137.         </div><!-- /container -->
  138.         <script>
  139.             (function() {
  140.    
  141.                 function init() {
  142.                     var speed = 250,
  143.                         easing = mina.easeinout;
  144.  
  145.                     [].slice.call ( document.querySelectorAll( '#grid > a' ) ).forEach( function( el ) {
  146.                         var s = Snap( el.querySelector( 'svg' ) ), path = s.select( 'path' ),
  147.                             pathConfig = {
  148.                                 from : path.attr( 'd' ),
  149.                                 to : el.getAttribute( 'data-path-hover' )
  150.                             };
  151.  
  152.                         el.addEventListener( 'mouseenter', function() {
  153.                             path.animate( { 'path' : pathConfig.to }, speed, easing );
  154.                         } );
  155.  
  156.                         el.addEventListener( 'mouseleave', function() {
  157.                             path.animate( { 'path' : pathConfig.from }, speed, easing );
  158.                         } );
  159.                     } );
  160.                 }
  161.  
  162.                 init();
  163.  
  164.             })();
  165.         </script>
  166.     </body>
  167. </html>