/** * svganimations.js v1.0.0 * http://www.codrops.com * * the svg path animation is based on http://24ways.org/2013/animating-vectors-with-svg/ by Brian Suda (@briansuda) * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2013, Codrops * http://www.codrops.com */ !function(){"use strict";var e=window.document.documentElement;window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),window.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(e){window.clearTimeout(e)}}();function t(e){this.el=e,this.image=this.el.previousElementSibling,this.current_frame=0,this.total_frames=60,this.path=new Array,this.length=new Array,this.handle=0,this.init()}t.prototype.init=function(){var e=this;[].slice.call(this.el.querySelectorAll("path")).forEach(function(t,n){e.path[n]=t;var i=e.path[n].getTotalLength();e.length[n]=i,e.path[n].style.strokeDasharray=i+" "+i,e.path[n].style.strokeDashoffset=i})},t.prototype.render=function(){this.rendered||(this.rendered=!0,this.draw())},t.prototype.draw=function(){var e=this,t=this.current_frame/this.total_frames;if(t>1)window.cancelAnimFrame(this.handle),this.showImage();else{this.current_frame++;for(var n=0,i=this.path.length;n=a}function a(){var e,n=Array.prototype.slice.call(document.querySelectorAll("#draw-svg svg")),i=new Array,o=!1;n.forEach(function(e,n){var o=new t(e);i[n]=o,setTimeout(function(e){return function(){r(e.parentNode)&&o.render()}}(e),250)});var a=function(){o||(o=!0,setTimeout(function(){s()},60))},s=function(){n.forEach(function(e,t){r(e.parentNode,.5)&&i[t].render()}),o=!1},c=function(){function t(){s(),e=null}e&&clearTimeout(e),e=setTimeout(t,200)};window.addEventListener("scroll",a,!1),window.addEventListener("resize",c,!1)}a()}();