File: /home/carrerup/.trash/techland/libs/wavify/wavify.min.js
/*
* Wavify
* JavaScript library to make some nice waves
* by peacepostman @ crezeo
*/
function wavify(e,t){void 0===t&&(t={});var n,o=Object.assign({},{container:t.container?t.container:"body",height:200,amplitude:100,speed:.15,bones:3,color:"rgba(255,255,255, 0.20)"},t),i=e,r=document.querySelector(o.container).getBoundingClientRect().width,a=document.querySelector(o.container).getBoundingClientRect().height,c=0,l=!1,u=!1;function y(){var e=window.Date.now();if(n){var t=(e-n)/1e3;n=e;var s=(c+=t)*Math.PI;u=TweenMax.to(i,o.speed,{attr:{d:function(e){var t="M "+e[0].x+" "+e[0].y,n={x:(e[1].x-e[0].x)/2,y:e[1].y-e[0].y+e[0].y+(e[1].y-e[0].y)};t+=" C "+n.x+" "+n.y+" "+n.x+" "+n.y+" "+e[1].x+" "+e[1].y;for(var o=n,i=-1,c=1;c<e.length-1;c++){Math.sqrt(o.x*o.x+o.y*o.y);var l={x:e[c].x-o.x+e[c].x,y:e[c].y-o.y+e[c].y};t+=" C "+l.x+" "+l.y+" "+l.x+" "+l.y+" "+e[c+1].x+" "+e[c+1].y,o=l,i=-i}return t+=" L "+r+" "+a,t+=" L 0 "+a+" Z"}(function(e){for(var t=[],n=0;n<=o.bones;n++){var i=n/o.bones*r,a=(e+(n+n%o.bones))*o.speed*100,c=Math.sin(a/100)*o.amplitude,l=Math.sin(a/100)*c+o.height;t.push({x:i,y:l})}return t}(s))},ease:Power1.easeInOut})}else n=e;l=requestAnimationFrame(y)}var s,d,f,p,x=(s=function(){v(),[],c=0,r=document.querySelector(o.container).getBoundingClientRect().width,a=document.querySelector(o.container).getBoundingClientRect().height,n=!1,m()},d=250,function(){var e=this,t=arguments;clearTimeout(p),p=setTimeout(function(){p=null,f||s.apply(e,t)},d),f&&!p&&s.apply(e,t)});function m(){l||(l=requestAnimationFrame(y))}function v(){l&&(cancelAnimationFrame(l),l=!1)}function g(){l&&(v(),u.kill(),u=TweenMax.set(i,{x:0,y:0,rotation:0,opacity:0,clearProps:"all",attr:{d:"M0,0",fill:""}}),window.removeEventListener("resize",x),l=!1)}return l||(u=TweenMax.set(i,{attr:{fill:o.color}}),m(),window.addEventListener("resize",x)),{reboot:function(e){var t;g(),void 0!==typeof e&&(t=e,o=Object.assign({},o,t)),u=TweenMax.set(i,{attr:{fill:o.color}}),m(),window.addEventListener("resize",x)},play:m,pause:v,kill:g,updateColor:function(e){void 0===typeof e.timing&&(e.timing=1),void 0===typeof e.color&&(e.color=o.color),u=TweenMax.to(i,parseInt(e.timing),{attr:{fill:e.color},onComplete:function(){void 0!==typeof e.onComplete&&"[object Function]"==={}.toString.call(e.onComplete)&&e.onComplete()}})}}}