/* KUTE.js - The Light Tweening Engine * package - SVG Plugin * desc - draw strokes, morph paths and SVG color props * by dnp_theme * Licensed under MIT-License */ (function (factory) { if (typeof define === 'function' && define.amd) { define(["./kute.js"], function(KUTE){ factory(KUTE); return KUTE; }); } else if(typeof module == "object" && typeof require == "function") { // We assume, that require() is sync. var KUTE = require("./kute.js"); // Export the modified one. Not really required, but convenient. module.exports = factory(KUTE); } else if ( typeof window.KUTE !== 'undefined' ) { // Browser globals window.KUTE.svg = window.KUTE.svg || factory(KUTE); } else { throw new Error("SVG Plugin require KUTE.js."); } }( function (KUTE) { 'use strict'; var K = window.KUTE, S = S || {}, p, DOM = K.dom, PP = K.pp, _svg = document.querySelector('path') || document.querySelector('svg'), _ns = _svg && _svg.ownerSVGElement && _svg.ownerSVGElement.namespaceURI || 'http://www.w3.org/2000/svg', _nm = ['strokeWidth', 'strokeOpacity', 'fillOpacity', 'stopOpacity'], // numeric SVG CSS props _cls = ['fill', 'stroke', 'stopColor'], // colors 'hex', 'rgb', 'rgba' -- #fff / rgb(0,0,0) / rgba(0,0,0,0) pathReg = /(m[^(h|v|l)]*|[vhl][^(v|h|l|z)]*)/gmi, // interpolate functions number = K.Interpolate.number, color = K.Interpolate.color, array = function array(a,b,l,v) { // array1, array2, array2.length, progress var na = [], i; for(i=0;i 1) { var coord = function (p) { var c = p.split(','); if (c.length != 2) { return; // return undefined } if (isNaN(c[0]) || isNaN(c[1])) { return; } return [parseFloat(c[0]), parseFloat(c[1])]; }; var dist = function (c1, c2) { if (c1 != undefined && c2 != undefined) { return Math.sqrt(Math.pow((c2[0]-c1[0]), 2) + Math.pow((c2[1]-c1[1]), 2)); } return 0; }; if (points.length > 2) { for (var i=0; i