/** * vivus - javascript library to make drawing animation on svg * @version v0.4.4 * @link https://github.com/maxwellito/vivus * @license mit */ "use strict";!function(){function t(t){if("undefined"==typeof t)throw new error('pathformer [constructor]: "element" parameter is required');if(t.constructor===string&&(t=document.getelementbyid(t),!t))throw new error('pathformer [constructor]: "element" parameter is not related to an existing id');if(!(t instanceof window.svgelement||t instanceof window.svggelement||/^svg$/i.test(t.nodename)))throw new error('pathformer [constructor]: "element" parameter must be a string or a svgelement');this.el=t,this.scan(t)}function e(t,e,n){r(),this.isready=!1,this.setelement(t,e),this.setoptions(e),this.setcallback(n),this.isready&&this.init()}t.prototype.types=["line","ellipse","circle","polygon","polyline","rect"],t.prototype.attr_watch=["cx","cy","points","r","rx","ry","x","x1","x2","y","y1","y2"],t.prototype.scan=function(t){for(var e,r,n,i,a=t.queryselectorall(this.types.join(",")),o=0;oo?s:o,0),i/2),s=math.min(math.max(0>s?o:s,0),a/2),e.d="m "+(r+o)+","+n+" l "+(r+i-o)+","+n+" a "+o+","+s+",0,0,1,"+(r+i)+","+(n+s)+" l "+(r+i)+","+(n+a-s)+" a "+o+","+s+",0,0,1,"+(r+i-o)+","+(n+a)+" l "+(r+o)+","+(n+a)+" a "+o+","+s+",0,0,1,"+r+","+(n+a-s)+" l "+r+","+(n+s)+" a "+o+","+s+",0,0,1,"+(r+o)+","+n}else e.d="m"+r+" "+n+" l"+(r+i)+" "+n+" l"+(r+i)+" "+(n+a)+" l"+r+" "+(n+a)+" z";return e},t.prototype.polylinetopath=function(t){var e,r,n={},i=t.points.trim().split(" ");if(-1===t.points.indexof(",")){var a=[];for(e=0;e=this.duration)throw new error("vivus [constructor]: delay must be shorter than duration")},e.prototype.setcallback=function(t){if(t&&t.constructor!==function)throw new error('vivus [constructor]: "callback" parameter must be a function');this.callback=t||function(){}},e.prototype.mapping=function(){var t,e,r,n,i,o,s,h;for(h=o=s=0,e=this.el.queryselectorall("path"),t=0;t1?e.length-1:1),this.reversestack&&this.map.reverse(),t=0;t=this.framelength))return this.trace(),this.handle=n(function(){t.drawer()}),void 0;this.stop(),this.currentframe=this.framelength,this.trace(),this.selfdestroy&&this.destroy()}this.callback(this),this.instancecallback&&(this.instancecallback(this),this.instancecallback=null)},e.prototype.trace=function(){var t,e,r,n;for(n=this.animtimingfunction(this.currentframe/this.framelength)*this.framelength,t=0;t=o+a*e&&s>=r},e.prototype.getviewporth=function(){var t=this.docelem.clientheight,e=window.innerheight;return e>t?e:t},e.prototype.scrolly=function(){return window.pageyoffset||this.docelem.scrolltop},r=function(){e.prototype.docelem||(e.prototype.docelem=window.document.documentelement,n=function(){return window.requestanimationframe||window.webkitrequestanimationframe||window.mozrequestanimationframe||window.orequestanimationframe||window.msrequestanimationframe||function(t){return window.settimeout(t,1e3/60)}}(),i=function(){return window.cancelanimationframe||window.webkitcancelanimationframe||window.mozcancelanimationframe||window.ocancelanimationframe||window.mscancelanimationframe||function(t){return window.cleartimeout(t)}}())},a=function(t,e){var r=parseint(t,10);return r>=0?r:e},"function"==typeof define&&define.amd?define([],function(){return e}):"object"==typeof exports?module.exports=e:window.vivus=e}();