Browse code

Initial commit

Benjamin Roth authored on22/05/2020 11:59:22
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,1281 @@
1
+/*
2
+ * anime.js v3.2.0
3
+ * (c) 2020 Julian Garnier
4
+ * Released under the MIT license
5
+ * animejs.com
6
+ */
7
+
8
+// Defaults
9
+
10
+var defaultInstanceSettings = {
11
+  update: null,
12
+  begin: null,
13
+  loopBegin: null,
14
+  changeBegin: null,
15
+  change: null,
16
+  changeComplete: null,
17
+  loopComplete: null,
18
+  complete: null,
19
+  loop: 1,
20
+  direction: 'normal',
21
+  autoplay: true,
22
+  timelineOffset: 0
23
+};
24
+
25
+var defaultTweenSettings = {
26
+  duration: 1000,
27
+  delay: 0,
28
+  endDelay: 0,
29
+  easing: 'easeOutElastic(1, .5)',
30
+  round: 0
31
+};
32
+
33
+var validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective', 'matrix', 'matrix3d'];
34
+
35
+// Caching
36
+
37
+var cache = {
38
+  CSS: {},
39
+  springs: {}
40
+};
41
+
42
+// Utils
43
+
44
+function minMax(val, min, max) {
45
+  return Math.min(Math.max(val, min), max);
46
+}
47
+
48
+function stringContains(str, text) {
49
+  return str.indexOf(text) > -1;
50
+}
51
+
52
+function applyArguments(func, args) {
53
+  return func.apply(null, args);
54
+}
55
+
56
+var is = {
57
+  arr: function (a) { return Array.isArray(a); },
58
+  obj: function (a) { return stringContains(Object.prototype.toString.call(a), 'Object'); },
59
+  pth: function (a) { return is.obj(a) && a.hasOwnProperty('totalLength'); },
60
+  svg: function (a) { return a instanceof SVGElement; },
61
+  inp: function (a) { return a instanceof HTMLInputElement; },
62
+  dom: function (a) { return a.nodeType || is.svg(a); },
63
+  str: function (a) { return typeof a === 'string'; },
64
+  fnc: function (a) { return typeof a === 'function'; },
65
+  und: function (a) { return typeof a === 'undefined'; },
66
+  hex: function (a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); },
67
+  rgb: function (a) { return /^rgb/.test(a); },
68
+  hsl: function (a) { return /^hsl/.test(a); },
69
+  col: function (a) { return (is.hex(a) || is.rgb(a) || is.hsl(a)); },
70
+  key: function (a) { return !defaultInstanceSettings.hasOwnProperty(a) && !defaultTweenSettings.hasOwnProperty(a) && a !== 'targets' && a !== 'keyframes'; }
71
+};
72
+
73
+// Easings
74
+
75
+function parseEasingParameters(string) {
76
+  var match = /\(([^)]+)\)/.exec(string);
77
+  return match ? match[1].split(',').map(function (p) { return parseFloat(p); }) : [];
78
+}
79
+
80
+// Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js
81
+
82
+function spring(string, duration) {
83
+
84
+  var params = parseEasingParameters(string);
85
+  var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100);
86
+  var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100);
87
+  var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100);
88
+  var velocity =  minMax(is.und(params[3]) ? 0 : params[3], .1, 100);
89
+  var w0 = Math.sqrt(stiffness / mass);
90
+  var zeta = damping / (2 * Math.sqrt(stiffness * mass));
91
+  var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
92
+  var a = 1;
93
+  var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
94
+
95
+  function solver(t) {
96
+    var progress = duration ? (duration * t) / 1000 : t;
97
+    if (zeta < 1) {
98
+      progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
99
+    } else {
100
+      progress = (a + b * progress) * Math.exp(-progress * w0);
101
+    }
102
+    if (t === 0 || t === 1) { return t; }
103
+    return 1 - progress;
104
+  }
105
+
106
+  function getDuration() {
107
+    var cached = cache.springs[string];
108
+    if (cached) { return cached; }
109
+    var frame = 1/6;
110
+    var elapsed = 0;
111
+    var rest = 0;
112
+    while(true) {
113
+      elapsed += frame;
114
+      if (solver(elapsed) === 1) {
115
+        rest++;
116
+        if (rest >= 16) { break; }
117
+      } else {
118
+        rest = 0;
119
+      }
120
+    }
121
+    var duration = elapsed * frame * 1000;
122
+    cache.springs[string] = duration;
123
+    return duration;
124
+  }
125
+
126
+  return duration ? solver : getDuration;
127
+
128
+}
129
+
130
+// Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function
131
+
132
+function steps(steps) {
133
+  if ( steps === void 0 ) steps = 10;
134
+
135
+  return function (t) { return Math.ceil((minMax(t, 0.000001, 1)) * steps) * (1 / steps); };
136
+}
137
+
138
+// BezierEasing https://github.com/gre/bezier-easing
139
+
140
+var bezier = (function () {
141
+
142
+  var kSplineTableSize = 11;
143
+  var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
144
+
145
+  function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 }
146
+  function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 }
147
+  function C(aA1)      { return 3.0 * aA1 }
148
+
149
+  function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT }
150
+  function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) }
151
+
152
+  function binarySubdivide(aX, aA, aB, mX1, mX2) {
153
+    var currentX, currentT, i = 0;
154
+    do {
155
+      currentT = aA + (aB - aA) / 2.0;
156
+      currentX = calcBezier(currentT, mX1, mX2) - aX;
157
+      if (currentX > 0.0) { aB = currentT; } else { aA = currentT; }
158
+    } while (Math.abs(currentX) > 0.0000001 && ++i < 10);
159
+    return currentT;
160
+  }
161
+
162
+  function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
163
+    for (var i = 0; i < 4; ++i) {
164
+      var currentSlope = getSlope(aGuessT, mX1, mX2);
165
+      if (currentSlope === 0.0) { return aGuessT; }
166
+      var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
167
+      aGuessT -= currentX / currentSlope;
168
+    }
169
+    return aGuessT;
170
+  }
171
+
172
+  function bezier(mX1, mY1, mX2, mY2) {
173
+
174
+    if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { return; }
175
+    var sampleValues = new Float32Array(kSplineTableSize);
176
+
177
+    if (mX1 !== mY1 || mX2 !== mY2) {
178
+      for (var i = 0; i < kSplineTableSize; ++i) {
179
+        sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
180
+      }
181
+    }
182
+
183
+    function getTForX(aX) {
184
+
185
+      var intervalStart = 0;
186
+      var currentSample = 1;
187
+      var lastSample = kSplineTableSize - 1;
188
+
189
+      for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
190
+        intervalStart += kSampleStepSize;
191
+      }
192
+
193
+      --currentSample;
194
+
195
+      var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
196
+      var guessForT = intervalStart + dist * kSampleStepSize;
197
+      var initialSlope = getSlope(guessForT, mX1, mX2);
198
+
199
+      if (initialSlope >= 0.001) {
200
+        return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
201
+      } else if (initialSlope === 0.0) {
202
+        return guessForT;
203
+      } else {
204
+        return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
205
+      }
206
+
207
+    }
208
+
209
+    return function (x) {
210
+      if (mX1 === mY1 && mX2 === mY2) { return x; }
211
+      if (x === 0 || x === 1) { return x; }
212
+      return calcBezier(getTForX(x), mY1, mY2);
213
+    }
214
+
215
+  }
216
+
217
+  return bezier;
218
+
219
+})();
220
+
221
+var penner = (function () {
222
+
223
+  // Based on jQuery UI's implemenation of easing equations from Robert Penner (http://www.robertpenner.com/easing)
224
+
225
+  var eases = { linear: function () { return function (t) { return t; }; } };
226
+
227
+  var functionEasings = {
228
+    Sine: function () { return function (t) { return 1 - Math.cos(t * Math.PI / 2); }; },
229
+    Circ: function () { return function (t) { return 1 - Math.sqrt(1 - t * t); }; },
230
+    Back: function () { return function (t) { return t * t * (3 * t - 2); }; },
231
+    Bounce: function () { return function (t) {
232
+      var pow2, b = 4;
233
+      while (t < (( pow2 = Math.pow(2, --b)) - 1) / 11) {}
234
+      return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow(( pow2 * 3 - 2 ) / 22 - t, 2)
235
+    }; },
236
+    Elastic: function (amplitude, period) {
237
+      if ( amplitude === void 0 ) amplitude = 1;
238
+      if ( period === void 0 ) period = .5;
239
+
240
+      var a = minMax(amplitude, 1, 10);
241
+      var p = minMax(period, .1, 2);
242
+      return function (t) {
243
+        return (t === 0 || t === 1) ? t : 
244
+          -a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);
245
+      }
246
+    }
247
+  };
248
+
249
+  var baseEasings = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo'];
250
+
251
+  baseEasings.forEach(function (name, i) {
252
+    functionEasings[name] = function () { return function (t) { return Math.pow(t, i + 2); }; };
253
+  });
254
+
255
+  Object.keys(functionEasings).forEach(function (name) {
256
+    var easeIn = functionEasings[name];
257
+    eases['easeIn' + name] = easeIn;
258
+    eases['easeOut' + name] = function (a, b) { return function (t) { return 1 - easeIn(a, b)(1 - t); }; };
259
+    eases['easeInOut' + name] = function (a, b) { return function (t) { return t < 0.5 ? easeIn(a, b)(t * 2) / 2 : 
260
+      1 - easeIn(a, b)(t * -2 + 2) / 2; }; };
261
+  });
262
+
263
+  return eases;
264
+
265
+})();
266
+
267
+function parseEasings(easing, duration) {
268
+  if (is.fnc(easing)) { return easing; }
269
+  var name = easing.split('(')[0];
270
+  var ease = penner[name];
271
+  var args = parseEasingParameters(easing);
272
+  switch (name) {
273
+    case 'spring' : return spring(easing, duration);
274
+    case 'cubicBezier' : return applyArguments(bezier, args);
275
+    case 'steps' : return applyArguments(steps, args);
276
+    default : return applyArguments(ease, args);
277
+  }
278
+}
279
+
280
+// Strings
281
+
282
+function selectString(str) {
283
+  try {
284
+    var nodes = document.querySelectorAll(str);
285
+    return nodes;
286
+  } catch(e) {
287
+    return;
288
+  }
289
+}
290
+
291
+// Arrays
292
+
293
+function filterArray(arr, callback) {
294
+  var len = arr.length;
295
+  var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
296
+  var result = [];
297
+  for (var i = 0; i < len; i++) {
298
+    if (i in arr) {
299
+      var val = arr[i];
300
+      if (callback.call(thisArg, val, i, arr)) {
301
+        result.push(val);
302
+      }
303
+    }
304
+  }
305
+  return result;
306
+}
307
+
308
+function flattenArray(arr) {
309
+  return arr.reduce(function (a, b) { return a.concat(is.arr(b) ? flattenArray(b) : b); }, []);
310
+}
311
+
312
+function toArray(o) {
313
+  if (is.arr(o)) { return o; }
314
+  if (is.str(o)) { o = selectString(o) || o; }
315
+  if (o instanceof NodeList || o instanceof HTMLCollection) { return [].slice.call(o); }
316
+  return [o];
317
+}
318
+
319
+function arrayContains(arr, val) {
320
+  return arr.some(function (a) { return a === val; });
321
+}
322
+
323
+// Objects
324
+
325
+function cloneObject(o) {
326
+  var clone = {};
327
+  for (var p in o) { clone[p] = o[p]; }
328
+  return clone;
329
+}
330
+
331
+function replaceObjectProps(o1, o2) {
332
+  var o = cloneObject(o1);
333
+  for (var p in o1) { o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p]; }
334
+  return o;
335
+}
336
+
337
+function mergeObjects(o1, o2) {
338
+  var o = cloneObject(o1);
339
+  for (var p in o2) { o[p] = is.und(o1[p]) ? o2[p] : o1[p]; }
340
+  return o;
341
+}
342
+
343
+// Colors
344
+
345
+function rgbToRgba(rgbValue) {
346
+  var rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);
347
+  return rgb ? ("rgba(" + (rgb[1]) + ",1)") : rgbValue;
348
+}
349
+
350
+function hexToRgba(hexValue) {
351
+  var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
352
+  var hex = hexValue.replace(rgx, function (m, r, g, b) { return r + r + g + g + b + b; } );
353
+  var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
354
+  var r = parseInt(rgb[1], 16);
355
+  var g = parseInt(rgb[2], 16);
356
+  var b = parseInt(rgb[3], 16);
357
+  return ("rgba(" + r + "," + g + "," + b + ",1)");
358
+}
359
+
360
+function hslToRgba(hslValue) {
361
+  var hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
362
+  var h = parseInt(hsl[1], 10) / 360;
363
+  var s = parseInt(hsl[2], 10) / 100;
364
+  var l = parseInt(hsl[3], 10) / 100;
365
+  var a = hsl[4] || 1;
366
+  function hue2rgb(p, q, t) {
367
+    if (t < 0) { t += 1; }
368
+    if (t > 1) { t -= 1; }
369
+    if (t < 1/6) { return p + (q - p) * 6 * t; }
370
+    if (t < 1/2) { return q; }
371
+    if (t < 2/3) { return p + (q - p) * (2/3 - t) * 6; }
372
+    return p;
373
+  }
374
+  var r, g, b;
375
+  if (s == 0) {
376
+    r = g = b = l;
377
+  } else {
378
+    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
379
+    var p = 2 * l - q;
380
+    r = hue2rgb(p, q, h + 1/3);
381
+    g = hue2rgb(p, q, h);
382
+    b = hue2rgb(p, q, h - 1/3);
383
+  }
384
+  return ("rgba(" + (r * 255) + "," + (g * 255) + "," + (b * 255) + "," + a + ")");
385
+}
386
+
387
+function colorToRgb(val) {
388
+  if (is.rgb(val)) { return rgbToRgba(val); }
389
+  if (is.hex(val)) { return hexToRgba(val); }
390
+  if (is.hsl(val)) { return hslToRgba(val); }
391
+}
392
+
393
+// Units
394
+
395
+function getUnit(val) {
396
+  var split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);
397
+  if (split) { return split[1]; }
398
+}
399
+
400
+function getTransformUnit(propName) {
401
+  if (stringContains(propName, 'translate') || propName === 'perspective') { return 'px'; }
402
+  if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) { return 'deg'; }
403
+}
404
+
405
+// Values
406
+
407
+function getFunctionValue(val, animatable) {
408
+  if (!is.fnc(val)) { return val; }
409
+  return val(animatable.target, animatable.id, animatable.total);
410
+}
411
+
412
+function getAttribute(el, prop) {
413
+  return el.getAttribute(prop);
414
+}
415
+
416
+function convertPxToUnit(el, value, unit) {
417
+  var valueUnit = getUnit(value);
418
+  if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) { return value; }
419
+  var cached = cache.CSS[value + unit];
420
+  if (!is.und(cached)) { return cached; }
421
+  var baseline = 100;
422
+  var tempEl = document.createElement(el.tagName);
423
+  var parentEl = (el.parentNode && (el.parentNode !== document)) ? el.parentNode : document.body;
424
+  parentEl.appendChild(tempEl);
425
+  tempEl.style.position = 'absolute';
426
+  tempEl.style.width = baseline + unit;
427
+  var factor = baseline / tempEl.offsetWidth;
428
+  parentEl.removeChild(tempEl);
429
+  var convertedUnit = factor * parseFloat(value);
430
+  cache.CSS[value + unit] = convertedUnit;
431
+  return convertedUnit;
432
+}
433
+
434
+function getCSSValue(el, prop, unit) {
435
+  if (prop in el.style) {
436
+    var uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
437
+    var value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0';
438
+    return unit ? convertPxToUnit(el, value, unit) : value;
439
+  }
440
+}
441
+
442
+function getAnimationType(el, prop) {
443
+  if (is.dom(el) && !is.inp(el) && (getAttribute(el, prop) || (is.svg(el) && el[prop]))) { return 'attribute'; }
444
+  if (is.dom(el) && arrayContains(validTransforms, prop)) { return 'transform'; }
445
+  if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) { return 'css'; }
446
+  if (el[prop] != null) { return 'object'; }
447
+}
448
+
449
+function getElementTransforms(el) {
450
+  if (!is.dom(el)) { return; }
451
+  var str = el.style.transform || '';
452
+  var reg  = /(\w+)\(([^)]*)\)/g;
453
+  var transforms = new Map();
454
+  var m; while (m = reg.exec(str)) { transforms.set(m[1], m[2]); }
455
+  return transforms;
456
+}
457
+
458
+function getTransformValue(el, propName, animatable, unit) {
459
+  var defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName);
460
+  var value = getElementTransforms(el).get(propName) || defaultVal;
461
+  if (animatable) {
462
+    animatable.transforms.list.set(propName, value);
463
+    animatable.transforms['last'] = propName;
464
+  }
465
+  return unit ? convertPxToUnit(el, value, unit) : value;
466
+}
467
+
468
+function getOriginalTargetValue(target, propName, unit, animatable) {
469
+  switch (getAnimationType(target, propName)) {
470
+    case 'transform': return getTransformValue(target, propName, animatable, unit);
471
+    case 'css': return getCSSValue(target, propName, unit);
472
+    case 'attribute': return getAttribute(target, propName);
473
+    default: return target[propName] || 0;
474
+  }
475
+}
476
+
477
+function getRelativeValue(to, from) {
478
+  var operator = /^(\*=|\+=|-=)/.exec(to);
479
+  if (!operator) { return to; }
480
+  var u = getUnit(to) || 0;
481
+  var x = parseFloat(from);
482
+  var y = parseFloat(to.replace(operator[0], ''));
483
+  switch (operator[0][0]) {
484
+    case '+': return x + y + u;
485
+    case '-': return x - y + u;
486
+    case '*': return x * y + u;
487
+  }
488
+}
489
+
490
+function validateValue(val, unit) {
491
+  if (is.col(val)) { return colorToRgb(val); }
492
+  if (/\s/g.test(val)) { return val; }
493
+  var originalUnit = getUnit(val);
494
+  var unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val;
495
+  if (unit) { return unitLess + unit; }
496
+  return unitLess;
497
+}
498
+
499
+// getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes
500
+// adapted from https://gist.github.com/SebLambla/3e0550c496c236709744
501
+
502
+function getDistance(p1, p2) {
503
+  return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
504
+}
505
+
506
+function getCircleLength(el) {
507
+  return Math.PI * 2 * getAttribute(el, 'r');
508
+}
509
+
510
+function getRectLength(el) {
511
+  return (getAttribute(el, 'width') * 2) + (getAttribute(el, 'height') * 2);
512
+}
513
+
514
+function getLineLength(el) {
515
+  return getDistance(
516
+    {x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1')}, 
517
+    {x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2')}
518
+  );
519
+}
520
+
521
+function getPolylineLength(el) {
522
+  var points = el.points;
523
+  var totalLength = 0;
524
+  var previousPos;
525
+  for (var i = 0 ; i < points.numberOfItems; i++) {
526
+    var currentPos = points.getItem(i);
527
+    if (i > 0) { totalLength += getDistance(previousPos, currentPos); }
528
+    previousPos = currentPos;
529
+  }
530
+  return totalLength;
531
+}
532
+
533
+function getPolygonLength(el) {
534
+  var points = el.points;
535
+  return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0));
536
+}
537
+
538
+// Path animation
539
+
540
+function getTotalLength(el) {
541
+  if (el.getTotalLength) { return el.getTotalLength(); }
542
+  switch(el.tagName.toLowerCase()) {
543
+    case 'circle': return getCircleLength(el);
544
+    case 'rect': return getRectLength(el);
545
+    case 'line': return getLineLength(el);
546
+    case 'polyline': return getPolylineLength(el);
547
+    case 'polygon': return getPolygonLength(el);
548
+  }
549
+}
550
+
551
+function setDashoffset(el) {
552
+  var pathLength = getTotalLength(el);
553
+  el.setAttribute('stroke-dasharray', pathLength);
554
+  return pathLength;
555
+}
556
+
557
+// Motion path
558
+
559
+function getParentSvgEl(el) {
560
+  var parentEl = el.parentNode;
561
+  while (is.svg(parentEl)) {
562
+    if (!is.svg(parentEl.parentNode)) { break; }
563
+    parentEl = parentEl.parentNode;
564
+  }
565
+  return parentEl;
566
+}
567
+
568
+function getParentSvg(pathEl, svgData) {
569
+  var svg = svgData || {};
570
+  var parentSvgEl = svg.el || getParentSvgEl(pathEl);
571
+  var rect = parentSvgEl.getBoundingClientRect();
572
+  var viewBoxAttr = getAttribute(parentSvgEl, 'viewBox');
573
+  var width = rect.width;
574
+  var height = rect.height;
575
+  var viewBox = svg.viewBox || (viewBoxAttr ? viewBoxAttr.split(' ') : [0, 0, width, height]);
576
+  return {
577
+    el: parentSvgEl,
578
+    viewBox: viewBox,
579
+    x: viewBox[0] / 1,
580
+    y: viewBox[1] / 1,
581
+    w: width / viewBox[2],
582
+    h: height / viewBox[3]
583
+  }
584
+}
585
+
586
+function getPath(path, percent) {
587
+  var pathEl = is.str(path) ? selectString(path)[0] : path;
588
+  var p = percent || 100;
589
+  return function(property) {
590
+    return {
591
+      property: property,
592
+      el: pathEl,
593
+      svg: getParentSvg(pathEl),
594
+      totalLength: getTotalLength(pathEl) * (p / 100)
595
+    }
596
+  }
597
+}
598
+
599
+function getPathProgress(path, progress) {
600
+  function point(offset) {
601
+    if ( offset === void 0 ) offset = 0;
602
+
603
+    var l = progress + offset >= 1 ? progress + offset : 0;
604
+    return path.el.getPointAtLength(l);
605
+  }
606
+  var svg = getParentSvg(path.el, path.svg);
607
+  var p = point();
608
+  var p0 = point(-1);
609
+  var p1 = point(+1);
610
+  switch (path.property) {
611
+    case 'x': return (p.x - svg.x) * svg.w;
612
+    case 'y': return (p.y - svg.y) * svg.h;
613
+    case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;
614
+  }
615
+}
616
+
617
+// Decompose value
618
+
619
+function decomposeValue(val, unit) {
620
+  // const rgx = /-?\d*\.?\d+/g; // handles basic numbers
621
+  // const rgx = /[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
622
+  var rgx = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
623
+  var value = validateValue((is.pth(val) ? val.totalLength : val), unit) + '';
624
+  return {
625
+    original: value,
626
+    numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
627
+    strings: (is.str(val) || unit) ? value.split(rgx) : []
628
+  }
629
+}
630
+
631
+// Animatables
632
+
633
+function parseTargets(targets) {
634
+  var targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
635
+  return filterArray(targetsArray, function (item, pos, self) { return self.indexOf(item) === pos; });
636
+}
637
+
638
+function getAnimatables(targets) {
639
+  var parsed = parseTargets(targets);
640
+  return parsed.map(function (t, i) {
641
+    return {target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } };
642
+  });
643
+}
644
+
645
+// Properties
646
+
647
+function normalizePropertyTweens(prop, tweenSettings) {
648
+  var settings = cloneObject(tweenSettings);
649
+  // Override duration if easing is a spring
650
+  if (/^spring/.test(settings.easing)) { settings.duration = spring(settings.easing); }
651
+  if (is.arr(prop)) {
652
+    var l = prop.length;
653
+    var isFromTo = (l === 2 && !is.obj(prop[0]));
654
+    if (!isFromTo) {
655
+      // Duration divided by the number of tweens
656
+      if (!is.fnc(tweenSettings.duration)) { settings.duration = tweenSettings.duration / l; }
657
+    } else {
658
+      // Transform [from, to] values shorthand to a valid tween value
659
+      prop = {value: prop};
660
+    }
661
+  }
662
+  var propArray = is.arr(prop) ? prop : [prop];
663
+  return propArray.map(function (v, i) {
664
+    var obj = (is.obj(v) && !is.pth(v)) ? v : {value: v};
665
+    // Default delay value should only be applied to the first tween
666
+    if (is.und(obj.delay)) { obj.delay = !i ? tweenSettings.delay : 0; }
667
+    // Default endDelay value should only be applied to the last tween
668
+    if (is.und(obj.endDelay)) { obj.endDelay = i === propArray.length - 1 ? tweenSettings.endDelay : 0; }
669
+    return obj;
670
+  }).map(function (k) { return mergeObjects(k, settings); });
671
+}
672
+
673
+
674
+function flattenKeyframes(keyframes) {
675
+  var propertyNames = filterArray(flattenArray(keyframes.map(function (key) { return Object.keys(key); })), function (p) { return is.key(p); })
676
+  .reduce(function (a,b) { if (a.indexOf(b) < 0) { a.push(b); } return a; }, []);
677
+  var properties = {};
678
+  var loop = function ( i ) {
679
+    var propName = propertyNames[i];
680
+    properties[propName] = keyframes.map(function (key) {
681
+      var newKey = {};
682
+      for (var p in key) {
683
+        if (is.key(p)) {
684
+          if (p == propName) { newKey.value = key[p]; }
685
+        } else {
686
+          newKey[p] = key[p];
687
+        }
688
+      }
689
+      return newKey;
690
+    });
691
+  };
692
+
693
+  for (var i = 0; i < propertyNames.length; i++) loop( i );
694
+  return properties;
695
+}
696
+
697
+function getProperties(tweenSettings, params) {
698
+  var properties = [];
699
+  var keyframes = params.keyframes;
700
+  if (keyframes) { params = mergeObjects(flattenKeyframes(keyframes), params); }
701
+  for (var p in params) {
702
+    if (is.key(p)) {
703
+      properties.push({
704
+        name: p,
705
+        tweens: normalizePropertyTweens(params[p], tweenSettings)
706
+      });
707
+    }
708
+  }
709
+  return properties;
710
+}
711
+
712
+// Tweens
713
+
714
+function normalizeTweenValues(tween, animatable) {
715
+  var t = {};
716
+  for (var p in tween) {
717
+    var value = getFunctionValue(tween[p], animatable);
718
+    if (is.arr(value)) {
719
+      value = value.map(function (v) { return getFunctionValue(v, animatable); });
720
+      if (value.length === 1) { value = value[0]; }
721
+    }
722
+    t[p] = value;
723
+  }
724
+  t.duration = parseFloat(t.duration);
725
+  t.delay = parseFloat(t.delay);
726
+  return t;
727
+}
728
+
729
+function normalizeTweens(prop, animatable) {
730
+  var previousTween;
731
+  return prop.tweens.map(function (t) {
732
+    var tween = normalizeTweenValues(t, animatable);
733
+    var tweenValue = tween.value;
734
+    var to = is.arr(tweenValue) ? tweenValue[1] : tweenValue;
735
+    var toUnit = getUnit(to);
736
+    var originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable);
737
+    var previousValue = previousTween ? previousTween.to.original : originalValue;
738
+    var from = is.arr(tweenValue) ? tweenValue[0] : previousValue;
739
+    var fromUnit = getUnit(from) || getUnit(originalValue);
740
+    var unit = toUnit || fromUnit;
741
+    if (is.und(to)) { to = previousValue; }
742
+    tween.from = decomposeValue(from, unit);
743
+    tween.to = decomposeValue(getRelativeValue(to, from), unit);
744
+    tween.start = previousTween ? previousTween.end : 0;
745
+    tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;
746
+    tween.easing = parseEasings(tween.easing, tween.duration);
747
+    tween.isPath = is.pth(tweenValue);
748
+    tween.isColor = is.col(tween.from.original);
749
+    if (tween.isColor) { tween.round = 1; }
750
+    previousTween = tween;
751
+    return tween;
752
+  });
753
+}
754
+
755
+// Tween progress
756
+
757
+var setProgressValue = {
758
+  css: function (t, p, v) { return t.style[p] = v; },
759
+  attribute: function (t, p, v) { return t.setAttribute(p, v); },
760
+  object: function (t, p, v) { return t[p] = v; },
761
+  transform: function (t, p, v, transforms, manual) {
762
+    transforms.list.set(p, v);
763
+    if (p === transforms.last || manual) {
764
+      var str = '';
765
+      transforms.list.forEach(function (value, prop) { str += prop + "(" + value + ") "; });
766
+      t.style.transform = str;
767
+    }
768
+  }
769
+};
770
+
771
+// Set Value helper
772
+
773
+function setTargetsValue(targets, properties) {
774
+  var animatables = getAnimatables(targets);
775
+  animatables.forEach(function (animatable) {
776
+    for (var property in properties) {
777
+      var value = getFunctionValue(properties[property], animatable);
778
+      var target = animatable.target;
779
+      var valueUnit = getUnit(value);
780
+      var originalValue = getOriginalTargetValue(target, property, valueUnit, animatable);
781
+      var unit = valueUnit || getUnit(originalValue);
782
+      var to = getRelativeValue(validateValue(value, unit), originalValue);
783
+      var animType = getAnimationType(target, property);
784
+      setProgressValue[animType](target, property, to, animatable.transforms, true);
785
+    }
786
+  });
787
+}
788
+
789
+// Animations
790
+
791
+function createAnimation(animatable, prop) {
792
+  var animType = getAnimationType(animatable.target, prop.name);
793
+  if (animType) {
794
+    var tweens = normalizeTweens(prop, animatable);
795
+    var lastTween = tweens[tweens.length - 1];
796
+    return {
797
+      type: animType,
798
+      property: prop.name,
799
+      animatable: animatable,
800
+      tweens: tweens,
801
+      duration: lastTween.end,
802
+      delay: tweens[0].delay,
803
+      endDelay: lastTween.endDelay
804
+    }
805
+  }
806
+}
807
+
808
+function getAnimations(animatables, properties) {
809
+  return filterArray(flattenArray(animatables.map(function (animatable) {
810
+    return properties.map(function (prop) {
811
+      return createAnimation(animatable, prop);
812
+    });
813
+  })), function (a) { return !is.und(a); });
814
+}
815
+
816
+// Create Instance
817
+
818
+function getInstanceTimings(animations, tweenSettings) {
819
+  var animLength = animations.length;
820
+  var getTlOffset = function (anim) { return anim.timelineOffset ? anim.timelineOffset : 0; };
821
+  var timings = {};
822
+  timings.duration = animLength ? Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration; })) : tweenSettings.duration;
823
+  timings.delay = animLength ? Math.min.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.delay; })) : tweenSettings.delay;
824
+  timings.endDelay = animLength ? timings.duration - Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration - anim.endDelay; })) : tweenSettings.endDelay;
825
+  return timings;
826
+}
827
+
828
+var instanceID = 0;
829
+
830
+function createNewInstance(params) {
831
+  var instanceSettings = replaceObjectProps(defaultInstanceSettings, params);
832
+  var tweenSettings = replaceObjectProps(defaultTweenSettings, params);
833
+  var properties = getProperties(tweenSettings, params);
834
+  var animatables = getAnimatables(params.targets);
835
+  var animations = getAnimations(animatables, properties);
836
+  var timings = getInstanceTimings(animations, tweenSettings);
837
+  var id = instanceID;
838
+  instanceID++;
839
+  return mergeObjects(instanceSettings, {
840
+    id: id,
841
+    children: [],
842
+    animatables: animatables,
843
+    animations: animations,
844
+    duration: timings.duration,
845
+    delay: timings.delay,
846
+    endDelay: timings.endDelay
847
+  });
848
+}
849
+
850
+// Core
851
+
852
+var activeInstances = [];
853
+var pausedInstances = [];
854
+var raf;
855
+
856
+var engine = (function () {
857
+  function play() { 
858
+    raf = requestAnimationFrame(step);
859
+  }
860
+  function step(t) {
861
+    var activeInstancesLength = activeInstances.length;
862
+    if (activeInstancesLength) {
863
+      var i = 0;
864
+      while (i < activeInstancesLength) {
865
+        var activeInstance = activeInstances[i];
866
+        if (!activeInstance.paused) {
867
+          activeInstance.tick(t);
868
+        } else {
869
+          var instanceIndex = activeInstances.indexOf(activeInstance);
870
+          if (instanceIndex > -1) {
871
+            activeInstances.splice(instanceIndex, 1);
872
+            activeInstancesLength = activeInstances.length;
873
+          }
874
+        }
875
+        i++;
876
+      }
877
+      play();
878
+    } else {
879
+      raf = cancelAnimationFrame(raf);
880
+    }
881
+  }
882
+  return play;
883
+})();
884
+
885
+function handleVisibilityChange() {
886
+  if (document.hidden) {
887
+    activeInstances.forEach(function (ins) { return ins.pause(); });
888
+    pausedInstances = activeInstances.slice(0);
889
+    anime.running = activeInstances = [];
890
+  } else {
891
+    pausedInstances.forEach(function (ins) { return ins.play(); });
892
+  }
893
+}
894
+
895
+if (typeof document !== 'undefined') {
896
+  document.addEventListener('visibilitychange', handleVisibilityChange);
897
+}
898
+
899
+// Public Instance
900
+
901
+function anime(params) {
902
+  if ( params === void 0 ) params = {};
903
+
904
+
905
+  var startTime = 0, lastTime = 0, now = 0;
906
+  var children, childrenLength = 0;
907
+  var resolve = null;
908
+
909
+  function makePromise(instance) {
910
+    var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
911
+    instance.finished = promise;
912
+    return promise;
913
+  }
914
+
915
+  var instance = createNewInstance(params);
916
+  var promise = makePromise(instance);
917
+
918
+  function toggleInstanceDirection() {
919
+    var direction = instance.direction;
920
+    if (direction !== 'alternate') {
921
+      instance.direction = direction !== 'normal' ? 'normal' : 'reverse';
922
+    }
923
+    instance.reversed = !instance.reversed;
924
+    children.forEach(function (child) { return child.reversed = instance.reversed; });
925
+  }
926
+
927
+  function adjustTime(time) {
928
+    return instance.reversed ? instance.duration - time : time;
929
+  }
930
+
931
+  function resetTime() {
932
+    startTime = 0;
933
+    lastTime = adjustTime(instance.currentTime) * (1 / anime.speed);
934
+  }
935
+
936
+  function seekChild(time, child) {
937
+    if (child) { child.seek(time - child.timelineOffset); }
938
+  }
939
+
940
+  function syncInstanceChildren(time) {
941
+    if (!instance.reversePlayback) {
942
+      for (var i = 0; i < childrenLength; i++) { seekChild(time, children[i]); }
943
+    } else {
944
+      for (var i$1 = childrenLength; i$1--;) { seekChild(time, children[i$1]); }
945
+    }
946
+  }
947
+
948
+  function setAnimationsProgress(insTime) {
949
+    var i = 0;
950
+    var animations = instance.animations;
951
+    var animationsLength = animations.length;
952
+    while (i < animationsLength) {
953
+      var anim = animations[i];
954
+      var animatable = anim.animatable;
955
+      var tweens = anim.tweens;
956
+      var tweenLength = tweens.length - 1;
957
+      var tween = tweens[tweenLength];
958
+      // Only check for keyframes if there is more than one tween
959
+      if (tweenLength) { tween = filterArray(tweens, function (t) { return (insTime < t.end); })[0] || tween; }
960
+      var elapsed = minMax(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
961
+      var eased = isNaN(elapsed) ? 1 : tween.easing(elapsed);
962
+      var strings = tween.to.strings;
963
+      var round = tween.round;
964
+      var numbers = [];
965
+      var toNumbersLength = tween.to.numbers.length;
966
+      var progress = (void 0);
967
+      for (var n = 0; n < toNumbersLength; n++) {
968
+        var value = (void 0);
969
+        var toNumber = tween.to.numbers[n];
970
+        var fromNumber = tween.from.numbers[n] || 0;
971
+        if (!tween.isPath) {
972
+          value = fromNumber + (eased * (toNumber - fromNumber));
973
+        } else {
974
+          value = getPathProgress(tween.value, eased * toNumber);
975
+        }
976
+        if (round) {
977
+          if (!(tween.isColor && n > 2)) {
978
+            value = Math.round(value * round) / round;
979
+          }
980
+        }
981
+        numbers.push(value);
982
+      }
983
+      // Manual Array.reduce for better performances
984
+      var stringsLength = strings.length;
985
+      if (!stringsLength) {
986
+        progress = numbers[0];
987
+      } else {
988
+        progress = strings[0];
989
+        for (var s = 0; s < stringsLength; s++) {
990
+          var a = strings[s];
991
+          var b = strings[s + 1];
992
+          var n$1 = numbers[s];
993
+          if (!isNaN(n$1)) {
994
+            if (!b) {
995
+              progress += n$1 + ' ';
996
+            } else {
997
+              progress += n$1 + b;
998
+            }
999
+          }
1000
+        }
1001
+      }
1002
+      setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms);
1003
+      anim.currentValue = progress;
1004
+      i++;
1005
+    }
1006
+  }
1007
+
1008
+  function setCallback(cb) {
1009
+    if (instance[cb] && !instance.passThrough) { instance[cb](instance); }
1010
+  }
1011
+
1012
+  function countIteration() {
1013
+    if (instance.remaining && instance.remaining !== true) {
1014
+      instance.remaining--;
1015
+    }
1016
+  }
1017
+
1018
+  function setInstanceProgress(engineTime) {
1019
+    var insDuration = instance.duration;
1020
+    var insDelay = instance.delay;
1021
+    var insEndDelay = insDuration - instance.endDelay;
1022
+    var insTime = adjustTime(engineTime);
1023
+    instance.progress = minMax((insTime / insDuration) * 100, 0, 100);
1024
+    instance.reversePlayback = insTime < instance.currentTime;
1025
+    if (children) { syncInstanceChildren(insTime); }
1026
+    if (!instance.began && instance.currentTime > 0) {
1027
+      instance.began = true;
1028
+      setCallback('begin');
1029
+    }
1030
+    if (!instance.loopBegan && instance.currentTime > 0) {
1031
+      instance.loopBegan = true;
1032
+      setCallback('loopBegin');
1033
+    }
1034
+    if (insTime <= insDelay && instance.currentTime !== 0) {
1035
+      setAnimationsProgress(0);
1036
+    }
1037
+    if ((insTime >= insEndDelay && instance.currentTime !== insDuration) || !insDuration) {
1038
+      setAnimationsProgress(insDuration);
1039
+    }
1040
+    if (insTime > insDelay && insTime < insEndDelay) {
1041
+      if (!instance.changeBegan) {
1042
+        instance.changeBegan = true;
1043
+        instance.changeCompleted = false;
1044
+        setCallback('changeBegin');
1045
+      }
1046
+      setCallback('change');
1047
+      setAnimationsProgress(insTime);
1048
+    } else {
1049
+      if (instance.changeBegan) {
1050
+        instance.changeCompleted = true;
1051
+        instance.changeBegan = false;
1052
+        setCallback('changeComplete');
1053
+      }
1054
+    }
1055
+    instance.currentTime = minMax(insTime, 0, insDuration);
1056
+    if (instance.began) { setCallback('update'); }
1057
+    if (engineTime >= insDuration) {
1058
+      lastTime = 0;
1059
+      countIteration();
1060
+      if (!instance.remaining) {
1061
+        instance.paused = true;
1062
+        if (!instance.completed) {
1063
+          instance.completed = true;
1064
+          setCallback('loopComplete');
1065
+          setCallback('complete');
1066
+          if (!instance.passThrough && 'Promise' in window) {
1067
+            resolve();
1068
+            promise = makePromise(instance);
1069
+          }
1070
+        }
1071
+      } else {
1072
+        startTime = now;
1073
+        setCallback('loopComplete');
1074
+        instance.loopBegan = false;
1075
+        if (instance.direction === 'alternate') {
1076
+          toggleInstanceDirection();
1077
+        }
1078
+      }
1079
+    }
1080
+  }
1081
+
1082
+  instance.reset = function() {
1083
+    var direction = instance.direction;
1084
+    instance.passThrough = false;
1085
+    instance.currentTime = 0;
1086
+    instance.progress = 0;
1087
+    instance.paused = true;
1088
+    instance.began = false;
1089
+    instance.loopBegan = false;
1090
+    instance.changeBegan = false;
1091
+    instance.completed = false;
1092
+    instance.changeCompleted = false;
1093
+    instance.reversePlayback = false;
1094
+    instance.reversed = direction === 'reverse';
1095
+    instance.remaining = instance.loop;
1096
+    children = instance.children;
1097
+    childrenLength = children.length;
1098
+    for (var i = childrenLength; i--;) { instance.children[i].reset(); }
1099
+    if (instance.reversed && instance.loop !== true || (direction === 'alternate' && instance.loop === 1)) { instance.remaining++; }
1100
+    setAnimationsProgress(instance.reversed ? instance.duration : 0);
1101
+  };
1102
+
1103
+  // Set Value helper
1104
+
1105
+  instance.set = function(targets, properties) {
1106
+    setTargetsValue(targets, properties);
1107
+    return instance;
1108
+  };
1109
+
1110
+  instance.tick = function(t) {
1111
+    now = t;
1112
+    if (!startTime) { startTime = now; }
1113
+    setInstanceProgress((now + (lastTime - startTime)) * anime.speed);
1114
+  };
1115
+
1116
+  instance.seek = function(time) {
1117
+    setInstanceProgress(adjustTime(time));
1118
+  };
1119
+
1120
+  instance.pause = function() {
1121
+    instance.paused = true;
1122
+    resetTime();
1123
+  };
1124
+
1125
+  instance.play = function() {
1126
+    if (!instance.paused) { return; }
1127
+    if (instance.completed) { instance.reset(); }
1128
+    instance.paused = false;
1129
+    activeInstances.push(instance);
1130
+    resetTime();
1131
+    if (!raf) { engine(); }
1132
+  };
1133
+
1134
+  instance.reverse = function() {
1135
+    toggleInstanceDirection();
1136
+    instance.completed = instance.reversed ? false : true;
1137
+    resetTime();
1138
+  };
1139
+
1140
+  instance.restart = function() {
1141
+    instance.reset();
1142
+    instance.play();
1143
+  };
1144
+
1145
+  instance.reset();
1146
+
1147
+  if (instance.autoplay) { instance.play(); }
1148
+
1149
+  return instance;
1150
+
1151
+}
1152
+
1153
+// Remove targets from animation
1154
+
1155
+function removeTargetsFromAnimations(targetsArray, animations) {
1156
+  for (var a = animations.length; a--;) {
1157
+    if (arrayContains(targetsArray, animations[a].animatable.target)) {
1158
+      animations.splice(a, 1);
1159
+    }
1160
+  }
1161
+}
1162
+
1163
+function removeTargets(targets) {
1164
+  var targetsArray = parseTargets(targets);
1165
+  for (var i = activeInstances.length; i--;) {
1166
+    var instance = activeInstances[i];
1167
+    var animations = instance.animations;
1168
+    var children = instance.children;
1169
+    removeTargetsFromAnimations(targetsArray, animations);
1170
+    for (var c = children.length; c--;) {
1171
+      var child = children[c];
1172
+      var childAnimations = child.animations;
1173
+      removeTargetsFromAnimations(targetsArray, childAnimations);
1174
+      if (!childAnimations.length && !child.children.length) { children.splice(c, 1); }
1175
+    }
1176
+    if (!animations.length && !children.length) { instance.pause(); }
1177
+  }
1178
+}
1179
+
1180
+// Stagger helpers
1181
+
1182
+function stagger(val, params) {
1183
+  if ( params === void 0 ) params = {};
1184
+
1185
+  var direction = params.direction || 'normal';
1186
+  var easing = params.easing ? parseEasings(params.easing) : null;
1187
+  var grid = params.grid;
1188
+  var axis = params.axis;
1189
+  var fromIndex = params.from || 0;
1190
+  var fromFirst = fromIndex === 'first';
1191
+  var fromCenter = fromIndex === 'center';
1192
+  var fromLast = fromIndex === 'last';
1193
+  var isRange = is.arr(val);
1194
+  var val1 = isRange ? parseFloat(val[0]) : parseFloat(val);
1195
+  var val2 = isRange ? parseFloat(val[1]) : 0;
1196
+  var unit = getUnit(isRange ? val[1] : val) || 0;
1197
+  var start = params.start || 0 + (isRange ? val1 : 0);
1198
+  var values = [];
1199
+  var maxValue = 0;
1200
+  return function (el, i, t) {
1201
+    if (fromFirst) { fromIndex = 0; }
1202
+    if (fromCenter) { fromIndex = (t - 1) / 2; }
1203
+    if (fromLast) { fromIndex = t - 1; }
1204
+    if (!values.length) {
1205
+      for (var index = 0; index < t; index++) {
1206
+        if (!grid) {
1207
+          values.push(Math.abs(fromIndex - index));
1208
+        } else {
1209
+          var fromX = !fromCenter ? fromIndex%grid[0] : (grid[0]-1)/2;
1210
+          var fromY = !fromCenter ? Math.floor(fromIndex/grid[0]) : (grid[1]-1)/2;
1211
+          var toX = index%grid[0];
1212
+          var toY = Math.floor(index/grid[0]);
1213
+          var distanceX = fromX - toX;
1214
+          var distanceY = fromY - toY;
1215
+          var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
1216
+          if (axis === 'x') { value = -distanceX; }
1217
+          if (axis === 'y') { value = -distanceY; }
1218
+          values.push(value);
1219
+        }
1220
+        maxValue = Math.max.apply(Math, values);
1221
+      }
1222
+      if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); }
1223
+      if (direction === 'reverse') { values = values.map(function (val) { return axis ? (val < 0) ? val * -1 : -val : Math.abs(maxValue - val); }); }
1224
+    }
1225
+    var spacing = isRange ? (val2 - val1) / maxValue : val1;
1226
+    return start + (spacing * (Math.round(values[i] * 100) / 100)) + unit;
1227
+  }
1228
+}
1229
+
1230
+// Timeline
1231
+
1232
+function timeline(params) {
1233
+  if ( params === void 0 ) params = {};
1234
+
1235
+  var tl = anime(params);
1236
+  tl.duration = 0;
1237
+  tl.add = function(instanceParams, timelineOffset) {
1238
+    var tlIndex = activeInstances.indexOf(tl);
1239
+    var children = tl.children;
1240
+    if (tlIndex > -1) { activeInstances.splice(tlIndex, 1); }
1241
+    function passThrough(ins) { ins.passThrough = true; }
1242
+    for (var i = 0; i < children.length; i++) { passThrough(children[i]); }
1243
+    var insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));
1244
+    insParams.targets = insParams.targets || params.targets;
1245
+    var tlDuration = tl.duration;
1246
+    insParams.autoplay = false;
1247
+    insParams.direction = tl.direction;
1248
+    insParams.timelineOffset = is.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration);
1249
+    passThrough(tl);
1250
+    tl.seek(insParams.timelineOffset);
1251
+    var ins = anime(insParams);
1252
+    passThrough(ins);
1253
+    children.push(ins);
1254
+    var timings = getInstanceTimings(children, params);
1255
+    tl.delay = timings.delay;
1256
+    tl.endDelay = timings.endDelay;
1257
+    tl.duration = timings.duration;
1258
+    tl.seek(0);
1259
+    tl.reset();
1260
+    if (tl.autoplay) { tl.play(); }
1261
+    return tl;
1262
+  };
1263
+  return tl;
1264
+}
1265
+
1266
+anime.version = '3.2.0';
1267
+anime.speed = 1;
1268
+anime.running = activeInstances;
1269
+anime.remove = removeTargets;
1270
+anime.get = getOriginalTargetValue;
1271
+anime.set = setTargetsValue;
1272
+anime.convertPx = convertPxToUnit;
1273
+anime.path = getPath;
1274
+anime.setDashoffset = setDashoffset;
1275
+anime.stagger = stagger;
1276
+anime.timeline = timeline;
1277
+anime.easing = parseEasings;
1278
+anime.penner = penner;
1279
+anime.random = function (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; };
1280
+
1281
+export default anime;