animejs 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/anime.js +109 -55
- package/anime.min.js +29 -25
- package/package.json +1 -1
package/anime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* http://animejs.com
|
|
3
3
|
* JavaScript animation engine
|
|
4
|
-
* @version v2.
|
|
4
|
+
* @version v2.2.0
|
|
5
5
|
* @author Julian Garnier
|
|
6
6
|
* @copyright ©2017 Julian Garnier
|
|
7
7
|
* Released under the MIT license
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
const is = {
|
|
56
56
|
arr: a => Array.isArray(a),
|
|
57
57
|
obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),
|
|
58
|
+
pth: a => is.obj(a) && a.hasOwnProperty('totalLength'),
|
|
58
59
|
svg: a => a instanceof SVGElement,
|
|
59
60
|
dom: a => a.nodeType || is.svg(a),
|
|
60
61
|
str: a => typeof a === 'string',
|
|
@@ -229,6 +230,21 @@
|
|
|
229
230
|
|
|
230
231
|
// Arrays
|
|
231
232
|
|
|
233
|
+
function filterArray(arr, callback) {
|
|
234
|
+
const len = arr.length;
|
|
235
|
+
const thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
|
236
|
+
let result = [];
|
|
237
|
+
for (let i = 0; i < len; i++) {
|
|
238
|
+
if (i in arr) {
|
|
239
|
+
const val = arr[i];
|
|
240
|
+
if (callback.call(thisArg, val, i, arr)) {
|
|
241
|
+
result.push(val);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
|
|
232
248
|
function flattenArray(arr) {
|
|
233
249
|
return arr.reduce((a, b) => a.concat(is.arr(b) ? flattenArray(b) : b), []);
|
|
234
250
|
}
|
|
@@ -246,10 +262,6 @@
|
|
|
246
262
|
|
|
247
263
|
// Objects
|
|
248
264
|
|
|
249
|
-
function objectHas(obj, prop) {
|
|
250
|
-
return obj.hasOwnProperty(prop);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
265
|
function cloneObject(o) {
|
|
254
266
|
let clone = {};
|
|
255
267
|
for (let p in o) clone[p] = o[p];
|
|
@@ -258,7 +270,7 @@
|
|
|
258
270
|
|
|
259
271
|
function replaceObjectProps(o1, o2) {
|
|
260
272
|
let o = cloneObject(o1);
|
|
261
|
-
for (let p in o1) o[p] =
|
|
273
|
+
for (let p in o1) o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p];
|
|
262
274
|
return o;
|
|
263
275
|
}
|
|
264
276
|
|
|
@@ -270,21 +282,27 @@
|
|
|
270
282
|
|
|
271
283
|
// Colors
|
|
272
284
|
|
|
273
|
-
function
|
|
285
|
+
function rgbToRgba(rgbValue) {
|
|
286
|
+
const rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);
|
|
287
|
+
return rgb ? `rgba(${rgb[1]},1)` : rgbValue;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function hexToRgba(hexValue) {
|
|
274
291
|
const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
275
292
|
const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b );
|
|
276
293
|
const rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
277
294
|
const r = parseInt(rgb[1], 16);
|
|
278
295
|
const g = parseInt(rgb[2], 16);
|
|
279
296
|
const b = parseInt(rgb[3], 16);
|
|
280
|
-
return `
|
|
297
|
+
return `rgba(${r},${g},${b},1)`;
|
|
281
298
|
}
|
|
282
299
|
|
|
283
|
-
function
|
|
284
|
-
const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue);
|
|
300
|
+
function hslToRgba(hslValue) {
|
|
301
|
+
const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
|
|
285
302
|
const h = parseInt(hsl[1]) / 360;
|
|
286
303
|
const s = parseInt(hsl[2]) / 100;
|
|
287
304
|
const l = parseInt(hsl[3]) / 100;
|
|
305
|
+
const a = hsl[4] || 1;
|
|
288
306
|
function hue2rgb(p, q, t) {
|
|
289
307
|
if (t < 0) t += 1;
|
|
290
308
|
if (t > 1) t -= 1;
|
|
@@ -303,13 +321,13 @@
|
|
|
303
321
|
g = hue2rgb(p, q, h);
|
|
304
322
|
b = hue2rgb(p, q, h - 1/3);
|
|
305
323
|
}
|
|
306
|
-
return `
|
|
324
|
+
return `rgba(${r * 255},${g * 255},${b * 255},${a})`;
|
|
307
325
|
}
|
|
308
326
|
|
|
309
327
|
function colorToRgb(val) {
|
|
310
|
-
if (is.rgb(val)) return val;
|
|
311
|
-
if (is.hex(val)) return
|
|
312
|
-
if (is.hsl(val)) return
|
|
328
|
+
if (is.rgb(val)) return rgbToRgba(val);
|
|
329
|
+
if (is.hex(val)) return hexToRgba(val);
|
|
330
|
+
if (is.hsl(val)) return hslToRgba(val);
|
|
313
331
|
}
|
|
314
332
|
|
|
315
333
|
// Units
|
|
@@ -361,7 +379,7 @@
|
|
|
361
379
|
props.push(match[1]);
|
|
362
380
|
values.push(match[2]);
|
|
363
381
|
}
|
|
364
|
-
const value = values
|
|
382
|
+
const value = filterArray(values, (val, i) => props[i] === propName);
|
|
365
383
|
return value.length ? value[0] : defaultVal;
|
|
366
384
|
}
|
|
367
385
|
|
|
@@ -454,10 +472,6 @@
|
|
|
454
472
|
|
|
455
473
|
// Motion path
|
|
456
474
|
|
|
457
|
-
function isPath(val) {
|
|
458
|
-
return is.obj(val) && objectHas(val, 'totalLength');
|
|
459
|
-
}
|
|
460
|
-
|
|
461
475
|
function getPath(path, percent) {
|
|
462
476
|
const el = is.str(path) ? selectString(path)[0] : path;
|
|
463
477
|
const p = percent || 100;
|
|
@@ -485,11 +499,11 @@
|
|
|
485
499
|
}
|
|
486
500
|
}
|
|
487
501
|
|
|
488
|
-
// Decompose
|
|
502
|
+
// Decompose value
|
|
489
503
|
|
|
490
504
|
function decomposeValue(val, unit) {
|
|
491
505
|
const rgx = /-?\d*\.?\d+/g;
|
|
492
|
-
const value = validateValue((
|
|
506
|
+
const value = validateValue((is.pth(val) ? val.totalLength : val), unit) + '';
|
|
493
507
|
return {
|
|
494
508
|
original: value,
|
|
495
509
|
numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
|
|
@@ -497,15 +511,11 @@
|
|
|
497
511
|
}
|
|
498
512
|
}
|
|
499
513
|
|
|
500
|
-
function recomposeValue(numbers, strings) {
|
|
501
|
-
return (strings.length === 0) ? numbers[0] : strings.reduce((a, b, i) => a + numbers[i - 1] + (b ? b : ' '));
|
|
502
|
-
}
|
|
503
|
-
|
|
504
514
|
// Animatables
|
|
505
515
|
|
|
506
516
|
function parseTargets(targets) {
|
|
507
517
|
const targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
|
|
508
|
-
return targetsArray
|
|
518
|
+
return filterArray(targetsArray, (item, pos, self) => self.indexOf(item) === pos);
|
|
509
519
|
}
|
|
510
520
|
|
|
511
521
|
function getAnimatables(targets) {
|
|
@@ -534,7 +544,7 @@
|
|
|
534
544
|
// Default delay value should be applied only on the first tween
|
|
535
545
|
const delay = !i ? tweenSettings.delay : 0;
|
|
536
546
|
// Use path object as a tween value
|
|
537
|
-
let obj = is.obj(v) && !
|
|
547
|
+
let obj = is.obj(v) && !is.pth(v) ? v : {value: v};
|
|
538
548
|
// Set default delay value
|
|
539
549
|
if (is.und(obj.delay)) obj.delay = delay;
|
|
540
550
|
return obj;
|
|
@@ -545,7 +555,7 @@
|
|
|
545
555
|
let properties = [];
|
|
546
556
|
const settings = mergeObjects(instanceSettings, tweenSettings);
|
|
547
557
|
for (let p in params) {
|
|
548
|
-
if (!
|
|
558
|
+
if (!settings.hasOwnProperty(p) && p !== 'targets') {
|
|
549
559
|
properties.push({
|
|
550
560
|
name: p,
|
|
551
561
|
offset: settings['offset'],
|
|
@@ -587,14 +597,15 @@
|
|
|
587
597
|
const from = is.arr(tweenValue) ? tweenValue[0] : previousValue;
|
|
588
598
|
const to = getRelativeValue(is.arr(tweenValue) ? tweenValue[1] : tweenValue, from);
|
|
589
599
|
const unit = getUnit(to) || getUnit(from) || getUnit(originalValue);
|
|
590
|
-
tween.isPath = isPath(tweenValue);
|
|
591
600
|
tween.from = decomposeValue(from, unit);
|
|
592
601
|
tween.to = decomposeValue(to, unit);
|
|
593
602
|
tween.start = previousTween ? previousTween.end : prop.offset;
|
|
594
603
|
tween.end = tween.start + tween.delay + tween.duration;
|
|
595
604
|
tween.easing = normalizeEasing(tween.easing);
|
|
596
605
|
tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;
|
|
597
|
-
|
|
606
|
+
tween.isPath = is.pth(tweenValue);
|
|
607
|
+
tween.isColor = is.col(tween.from.original);
|
|
608
|
+
if (tween.isColor) tween.round = 1;
|
|
598
609
|
previousTween = tween;
|
|
599
610
|
return tween;
|
|
600
611
|
});
|
|
@@ -630,18 +641,22 @@
|
|
|
630
641
|
}
|
|
631
642
|
|
|
632
643
|
function getAnimations(animatables, properties) {
|
|
633
|
-
return flattenArray(animatables.map(animatable => {
|
|
644
|
+
return filterArray(flattenArray(animatables.map(animatable => {
|
|
634
645
|
return properties.map(prop => {
|
|
635
646
|
return createAnimation(animatable, prop);
|
|
636
647
|
});
|
|
637
|
-
}))
|
|
648
|
+
})), a => !is.und(a));
|
|
638
649
|
}
|
|
639
650
|
|
|
640
651
|
// Create Instance
|
|
641
652
|
|
|
642
|
-
function getInstanceTimings(type, animations, tweenSettings) {
|
|
643
|
-
const
|
|
644
|
-
|
|
653
|
+
function getInstanceTimings(type, animations, instanceSettings, tweenSettings) {
|
|
654
|
+
const isDelay = (type === 'delay');
|
|
655
|
+
if (animations.length) {
|
|
656
|
+
return (isDelay ? Math.min : Math.max).apply(Math, animations.map(anim => anim[type]));
|
|
657
|
+
} else {
|
|
658
|
+
return isDelay ? tweenSettings.delay : instanceSettings.offset + tweenSettings.delay + tweenSettings.duration;
|
|
659
|
+
}
|
|
645
660
|
}
|
|
646
661
|
|
|
647
662
|
function createNewInstance(params) {
|
|
@@ -654,8 +669,8 @@
|
|
|
654
669
|
children: [],
|
|
655
670
|
animatables: animatables,
|
|
656
671
|
animations: animations,
|
|
657
|
-
duration: getInstanceTimings('duration', animations, tweenSettings),
|
|
658
|
-
delay: getInstanceTimings('delay', animations, tweenSettings)
|
|
672
|
+
duration: getInstanceTimings('duration', animations, instanceSettings, tweenSettings),
|
|
673
|
+
delay: getInstanceTimings('delay', animations, instanceSettings, tweenSettings)
|
|
659
674
|
});
|
|
660
675
|
}
|
|
661
676
|
|
|
@@ -710,10 +725,11 @@
|
|
|
710
725
|
|
|
711
726
|
function syncInstanceChildren(time) {
|
|
712
727
|
const children = instance.children;
|
|
728
|
+
const childrenLength = children.length;
|
|
713
729
|
if (time >= instance.currentTime) {
|
|
714
|
-
for (let i = 0; i <
|
|
730
|
+
for (let i = 0; i < childrenLength; i++) children[i].seek(time);
|
|
715
731
|
} else {
|
|
716
|
-
for (let i =
|
|
732
|
+
for (let i = childrenLength; i--;) children[i].seek(time);
|
|
717
733
|
}
|
|
718
734
|
}
|
|
719
735
|
|
|
@@ -721,27 +737,64 @@
|
|
|
721
737
|
let i = 0;
|
|
722
738
|
let transforms = {};
|
|
723
739
|
const animations = instance.animations;
|
|
724
|
-
|
|
740
|
+
const animationsLength = animations.length;
|
|
741
|
+
while (i < animationsLength) {
|
|
725
742
|
const anim = animations[i];
|
|
726
743
|
const animatable = anim.animatable;
|
|
727
744
|
const tweens = anim.tweens;
|
|
728
|
-
const
|
|
745
|
+
const tweenLength = tweens.length - 1;
|
|
746
|
+
let tween = tweens[tweenLength];
|
|
747
|
+
// Only check for keyframes if there is more than one tween
|
|
748
|
+
if (tweenLength) tween = filterArray(tweens, t => (insTime < t.end))[0] || tween;
|
|
729
749
|
const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
|
|
730
750
|
const eased = isNaN(elapsed) ? 1 : tween.easing(elapsed, tween.elasticity);
|
|
751
|
+
const strings = tween.to.strings;
|
|
731
752
|
const round = tween.round;
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
753
|
+
let numbers = [];
|
|
754
|
+
let progress;
|
|
755
|
+
const toNumbersLength = tween.to.numbers.length;
|
|
756
|
+
for (let n = 0; n < toNumbersLength; n++) {
|
|
757
|
+
let value;
|
|
758
|
+
const toNumber = tween.to.numbers[n];
|
|
759
|
+
const fromNumber = tween.from.numbers[n];
|
|
760
|
+
if (!tween.isPath) {
|
|
761
|
+
value = fromNumber + (eased * (toNumber - fromNumber));
|
|
762
|
+
} else {
|
|
763
|
+
value = getPathProgress(tween.value, eased * toNumber);
|
|
764
|
+
}
|
|
765
|
+
if (round) {
|
|
766
|
+
if (!(tween.isColor && n > 2)) {
|
|
767
|
+
value = Math.round(value * round) / round;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
numbers.push(value);
|
|
771
|
+
}
|
|
772
|
+
// Manual Array.reduce for better performances
|
|
773
|
+
const stringsLength = strings.length;
|
|
774
|
+
if (!stringsLength) {
|
|
775
|
+
progress = numbers[0];
|
|
776
|
+
} else {
|
|
777
|
+
progress = strings[0];
|
|
778
|
+
for (let s = 0; s < stringsLength; s++) {
|
|
779
|
+
const a = strings[s];
|
|
780
|
+
const b = strings[s + 1];
|
|
781
|
+
const n = numbers[s];
|
|
782
|
+
if (!isNaN(n)) {
|
|
783
|
+
if (!b) {
|
|
784
|
+
progress += n + ' ';
|
|
785
|
+
} else {
|
|
786
|
+
progress += n + b;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
739
791
|
setTweenProgress[anim.type](animatable.target, anim.property, progress, transforms, animatable.id);
|
|
740
792
|
anim.currentValue = progress;
|
|
741
793
|
i++;
|
|
742
794
|
}
|
|
743
|
-
|
|
744
|
-
|
|
795
|
+
const transformsLength = Object.keys(transforms).length;
|
|
796
|
+
if (transformsLength) {
|
|
797
|
+
for (let id = 0; id < transformsLength; id++) {
|
|
745
798
|
if (!transformString) {
|
|
746
799
|
const t = 'transform';
|
|
747
800
|
transformString = (getCSSValue(document.body, t) ? t : `-webkit-${t}`);
|
|
@@ -766,17 +819,17 @@
|
|
|
766
819
|
function setInstanceProgress(engineTime) {
|
|
767
820
|
const insDuration = instance.duration;
|
|
768
821
|
const insOffset = instance.offset;
|
|
769
|
-
const
|
|
822
|
+
const insStart = insOffset + instance.delay;
|
|
770
823
|
const insCurrentTime = instance.currentTime;
|
|
771
824
|
const insReversed = instance.reversed;
|
|
772
825
|
const insTime = adjustTime(engineTime);
|
|
773
826
|
if (instance.children.length) syncInstanceChildren(insTime);
|
|
774
|
-
if (insTime >=
|
|
775
|
-
setCallback('run');
|
|
827
|
+
if (insTime >= insStart || !insDuration) {
|
|
776
828
|
if (!instance.began) {
|
|
777
829
|
instance.began = true;
|
|
778
830
|
setCallback('begin');
|
|
779
831
|
}
|
|
832
|
+
setCallback('run');
|
|
780
833
|
}
|
|
781
834
|
if (insTime > insOffset && insTime < insDuration) {
|
|
782
835
|
setAnimationsProgress(insTime);
|
|
@@ -785,7 +838,7 @@
|
|
|
785
838
|
setAnimationsProgress(0);
|
|
786
839
|
if (insReversed) countIteration();
|
|
787
840
|
}
|
|
788
|
-
if (insTime >= insDuration && insCurrentTime !== insDuration) {
|
|
841
|
+
if ((insTime >= insDuration && insCurrentTime !== insDuration) || !insDuration) {
|
|
789
842
|
setAnimationsProgress(insDuration);
|
|
790
843
|
if (!insReversed) countIteration();
|
|
791
844
|
}
|
|
@@ -904,6 +957,7 @@
|
|
|
904
957
|
const tlDuration = tl.duration;
|
|
905
958
|
const insOffset = insParams.offset;
|
|
906
959
|
insParams.autoplay = false;
|
|
960
|
+
insParams.direction = tl.direction;
|
|
907
961
|
insParams.offset = is.und(insOffset) ? tlDuration : getRelativeValue(insOffset, tlDuration);
|
|
908
962
|
tl.began = true;
|
|
909
963
|
tl.completed = true;
|
|
@@ -922,7 +976,7 @@
|
|
|
922
976
|
return tl;
|
|
923
977
|
}
|
|
924
978
|
|
|
925
|
-
anime.version = '2.
|
|
979
|
+
anime.version = '2.2.0';
|
|
926
980
|
anime.speed = 1;
|
|
927
981
|
anime.running = activeInstances;
|
|
928
982
|
anime.remove = removeTargets;
|
package/anime.min.js
CHANGED
|
@@ -2,28 +2,32 @@
|
|
|
2
2
|
2017 Julian Garnier
|
|
3
3
|
Released under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
var $jscomp
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
a
|
|
12
|
-
|
|
13
|
-
b
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
f.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,r,p){if(p.get||p.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[r]=p.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
|
|
6
|
+
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};
|
|
7
|
+
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var r=0;return $jscomp.iteratorPrototype(function(){return r<e.length?{done:!1,value:e[r++]}:{done:!0}})};
|
|
8
|
+
$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,r){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var p=0,m={next:function(){if(p<e.length){var u=p++;return{value:r(u,e[u]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};
|
|
9
|
+
$jscomp.polyfill=function(e,r,p,m){if(r){p=$jscomp.global;e=e.split(".");for(m=0;m<e.length-1;m++){var u=e[m];u in p||(p[u]={});p=p[u]}e=e[e.length-1];m=p[e];r=r(m);r!=m&&null!=r&&$jscomp.defineProperty(p,e,{configurable:!0,writable:!0,value:r})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");var $jscomp$this=this;
|
|
10
|
+
(function(e,r){"function"===typeof define&&define.amd?define([],r):"object"===typeof module&&module.exports?module.exports=r():e.anime=r()})(this,function(){function e(a){if(!h.col(a))try{return document.querySelectorAll(a)}catch(c){}}function r(a,c){for(var d=a.length,b=2<=arguments.length?arguments[1]:void 0,f=[],n=0;n<d;n++)if(n in a){var k=a[n];c.call(b,k,n,a)&&f.push(k)}return f}function p(a){return a.reduce(function(a,d){return a.concat(h.arr(d)?p(d):d)},[])}function m(a){if(h.arr(a))return a;
|
|
11
|
+
h.str(a)&&(a=e(a)||a);return a instanceof NodeList||a instanceof HTMLCollection?[].slice.call(a):[a]}function u(a,c){return a.some(function(a){return a===c})}function C(a){var c={},d;for(d in a)c[d]=a[d];return c}function D(a,c){var d=C(a),b;for(b in a)d[b]=c.hasOwnProperty(b)?c[b]:a[b];return d}function z(a,c){var d=C(a),b;for(b in c)d[b]=h.und(a[b])?c[b]:a[b];return d}function T(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,c,d,k){return c+c+d+d+k+k});var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);
|
|
12
|
+
a=parseInt(c[1],16);var d=parseInt(c[2],16),c=parseInt(c[3],16);return"rgba("+a+","+d+","+c+",1)"}function U(a){function c(a,c,b){0>b&&(b+=1);1<b&&--b;return b<1/6?a+6*(c-a)*b:.5>b?c:b<2/3?a+(c-a)*(2/3-b)*6:a}var d=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a=parseInt(d[1])/360;var b=parseInt(d[2])/100,f=parseInt(d[3])/100,d=d[4]||1;if(0==b)f=b=a=f;else{var n=.5>f?f*(1+b):f+b-f*b,k=2*f-n,f=c(k,n,a+1/3),b=c(k,n,a);a=c(k,n,a-1/3)}return"rgba("+
|
|
13
|
+
255*f+","+255*b+","+255*a+","+d+")"}function y(a){if(a=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a))return a[2]}function V(a){if(-1<a.indexOf("translate")||"perspective"===a)return"px";if(-1<a.indexOf("rotate")||-1<a.indexOf("skew"))return"deg"}function I(a,c){return h.fnc(a)?a(c.target,c.id,c.total):a}function E(a,c){if(c in a.style)return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())||"0"}function J(a,c){if(h.dom(a)&&
|
|
14
|
+
u(W,c))return"transform";if(h.dom(a)&&(a.getAttribute(c)||h.svg(a)&&a[c]))return"attribute";if(h.dom(a)&&"transform"!==c&&E(a,c))return"css";if(null!=a[c])return"object"}function X(a,c){var d=V(c),d=-1<c.indexOf("scale")?1:0+d;a=a.style.transform;if(!a)return d;for(var b=[],f=[],n=[],k=/(\w+)\((.+?)\)/g;b=k.exec(a);)f.push(b[1]),n.push(b[2]);a=r(n,function(a,b){return f[b]===c});return a.length?a[0]:d}function K(a,c){switch(J(a,c)){case "transform":return X(a,c);case "css":return E(a,c);case "attribute":return a.getAttribute(c)}return a[c]||
|
|
15
|
+
0}function L(a,c){var d=/^(\*=|\+=|-=)/.exec(a);if(!d)return a;var b=y(a)||0;c=parseFloat(c);a=parseFloat(a.replace(d[0],""));switch(d[0][0]){case "+":return c+a+b;case "-":return c-a+b;case "*":return c*a+b}}function F(a,c){return Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2))}function M(a){a=a.points;for(var c=0,d,b=0;b<a.numberOfItems;b++){var f=a.getItem(b);0<b&&(c+=F(d,f));d=f}return c}function N(a){if(a.getTotalLength)return a.getTotalLength();switch(a.tagName.toLowerCase()){case "circle":return 2*
|
|
16
|
+
Math.PI*a.getAttribute("r");case "rect":return 2*a.getAttribute("width")+2*a.getAttribute("height");case "line":return F({x:a.getAttribute("x1"),y:a.getAttribute("y1")},{x:a.getAttribute("x2"),y:a.getAttribute("y2")});case "polyline":return M(a);case "polygon":var c=a.points;return M(a)+F(c.getItem(c.numberOfItems-1),c.getItem(0))}}function Y(a,c){function d(b){b=void 0===b?0:b;return a.el.getPointAtLength(1<=c+b?c+b:0)}var b=d(),f=d(-1),n=d(1);switch(a.property){case "x":return b.x;case "y":return b.y;
|
|
17
|
+
case "angle":return 180*Math.atan2(n.y-f.y,n.x-f.x)/Math.PI}}function O(a,c){var d=/-?\d*\.?\d+/g,b;b=h.pth(a)?a.totalLength:a;if(h.col(b))if(h.rgb(b)){var f=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b=f?"rgba("+f[1]+",1)":b}else b=h.hex(b)?T(b):h.hsl(b)?U(b):void 0;else f=(f=y(b))?b.substr(0,b.length-f.length):b,b=c&&!/\s/g.test(b)?f+c:f;b+="";return{original:b,numbers:b.match(d)?b.match(d).map(Number):[0],strings:h.str(a)||c?b.split(d):[]}}function P(a){a=a?p(h.arr(a)?a.map(m):m(a)):[];return r(a,
|
|
18
|
+
function(a,d,b){return b.indexOf(a)===d})}function Z(a){var c=P(a);return c.map(function(a,b){return{target:a,id:b,total:c.length}})}function aa(a,c){var d=C(c);if(h.arr(a)){var b=a.length;2!==b||h.obj(a[0])?h.fnc(c.duration)||(d.duration=c.duration/b):a={value:a}}return m(a).map(function(a,b){b=b?0:c.delay;a=h.obj(a)&&!h.pth(a)?a:{value:a};h.und(a.delay)&&(a.delay=b);return a}).map(function(a){return z(a,d)})}function ba(a,c){var d={},b;for(b in a){var f=I(a[b],c);h.arr(f)&&(f=f.map(function(a){return I(a,
|
|
19
|
+
c)}),1===f.length&&(f=f[0]));d[b]=f}d.duration=parseFloat(d.duration);d.delay=parseFloat(d.delay);return d}function ca(a){return h.arr(a)?A.apply(this,a):Q[a]}function da(a,c){var d;return a.tweens.map(function(b){b=ba(b,c);var f=b.value,e=K(c.target,a.name),k=d?d.to.original:e,k=h.arr(f)?f[0]:k,w=L(h.arr(f)?f[1]:f,k),e=y(w)||y(k)||y(e);b.from=O(k,e);b.to=O(w,e);b.start=d?d.end:a.offset;b.end=b.start+b.delay+b.duration;b.easing=ca(b.easing);b.elasticity=(1E3-Math.min(Math.max(b.elasticity,1),999))/
|
|
20
|
+
1E3;b.isPath=h.pth(f);b.isColor=h.col(b.from.original);b.isColor&&(b.round=1);return d=b})}function ea(a,c){return r(p(a.map(function(a){return c.map(function(b){var c=J(a.target,b.name);if(c){var d=da(b,a);b={type:c,property:b.name,animatable:a,tweens:d,duration:d[d.length-1].end,delay:d[0].delay}}else b=void 0;return b})})),function(a){return!h.und(a)})}function R(a,c,d,b){var f="delay"===a;return c.length?(f?Math.min:Math.max).apply(Math,c.map(function(b){return b[a]})):f?b.delay:d.offset+b.delay+
|
|
21
|
+
b.duration}function fa(a){var c=D(ga,a),d=D(S,a),b=Z(a.targets),f=[],e=z(c,d),k;for(k in a)e.hasOwnProperty(k)||"targets"===k||f.push({name:k,offset:e.offset,tweens:aa(a[k],d)});a=ea(b,f);return z(c,{children:[],animatables:b,animations:a,duration:R("duration",a,c,d),delay:R("delay",a,c,d)})}function q(a){function c(){return window.Promise&&new Promise(function(a){return p=a})}function d(a){return g.reversed?g.duration-a:a}function b(a){for(var b=0,c={},d=g.animations,f=d.length;b<f;){var e=d[b],
|
|
22
|
+
k=e.animatable,h=e.tweens,n=h.length-1,l=h[n];n&&(l=r(h,function(b){return a<b.end})[0]||l);for(var h=Math.min(Math.max(a-l.start-l.delay,0),l.duration)/l.duration,w=isNaN(h)?1:l.easing(h,l.elasticity),h=l.to.strings,p=l.round,n=[],m=void 0,m=l.to.numbers.length,t=0;t<m;t++){var x=void 0,x=l.to.numbers[t],q=l.from.numbers[t],x=l.isPath?Y(l.value,w*x):q+w*(x-q);p&&(l.isColor&&2<t||(x=Math.round(x*p)/p));n.push(x)}if(l=h.length)for(m=h[0],w=0;w<l;w++)p=h[w+1],t=n[w],isNaN(t)||(m=p?m+(t+p):m+(t+" "));
|
|
23
|
+
else m=n[0];ha[e.type](k.target,e.property,m,c,k.id);e.currentValue=m;b++}if(b=Object.keys(c).length)for(d=0;d<b;d++)H||(H=E(document.body,"transform")?"transform":"-webkit-transform"),g.animatables[d].target.style[H]=c[d].join(" ");g.currentTime=a;g.progress=a/g.duration*100}function f(a){if(g[a])g[a](g)}function e(){g.remaining&&!0!==g.remaining&&g.remaining--}function k(a){var k=g.duration,n=g.offset,w=n+g.delay,r=g.currentTime,x=g.reversed,q=d(a);if(g.children.length){var u=g.children,v=u.length;
|
|
24
|
+
if(q>=g.currentTime)for(var G=0;G<v;G++)u[G].seek(q);else for(;v--;)u[v].seek(q)}if(q>=w||!k)g.began||(g.began=!0,f("begin")),f("run");if(q>n&&q<k)b(q);else if(q<=n&&0!==r&&(b(0),x&&e()),q>=k&&r!==k||!k)b(k),x||e();f("update");a>=k&&(g.remaining?(t=h,"alternate"===g.direction&&(g.reversed=!g.reversed)):(g.pause(),g.completed||(g.completed=!0,f("complete"),"Promise"in window&&(p(),m=c()))),l=0)}a=void 0===a?{}:a;var h,t,l=0,p=null,m=c(),g=fa(a);g.reset=function(){var a=g.direction,c=g.loop;g.currentTime=
|
|
25
|
+
0;g.progress=0;g.paused=!0;g.began=!1;g.completed=!1;g.reversed="reverse"===a;g.remaining="alternate"===a&&1===c?2:c;b(0);for(a=g.children.length;a--;)g.children[a].reset()};g.tick=function(a){h=a;t||(t=h);k((l+h-t)*q.speed)};g.seek=function(a){k(d(a))};g.pause=function(){var a=v.indexOf(g);-1<a&&v.splice(a,1);g.paused=!0};g.play=function(){g.paused&&(g.paused=!1,t=0,l=d(g.currentTime),v.push(g),B||ia())};g.reverse=function(){g.reversed=!g.reversed;t=0;l=d(g.currentTime)};g.restart=function(){g.pause();
|
|
26
|
+
g.reset();g.play()};g.finished=m;g.reset();g.autoplay&&g.play();return g}var ga={update:void 0,begin:void 0,run:void 0,complete:void 0,loop:1,direction:"normal",autoplay:!0,offset:0},S={duration:1E3,delay:0,easing:"easeOutElastic",elasticity:500,round:0},W="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "),H,h={arr:function(a){return Array.isArray(a)},obj:function(a){return-1<Object.prototype.toString.call(a).indexOf("Object")},
|
|
27
|
+
pth:function(a){return h.obj(a)&&a.hasOwnProperty("totalLength")},svg:function(a){return a instanceof SVGElement},dom:function(a){return a.nodeType||h.svg(a)},str:function(a){return"string"===typeof a},fnc:function(a){return"function"===typeof a},und:function(a){return"undefined"===typeof a},hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},rgb:function(a){return/^rgb/.test(a)},hsl:function(a){return/^hsl/.test(a)},col:function(a){return h.hex(a)||h.rgb(a)||h.hsl(a)}},A=function(){function a(a,
|
|
28
|
+
d,b){return(((1-3*b+3*d)*a+(3*b-6*d))*a+3*d)*a}return function(c,d,b,f){if(0<=c&&1>=c&&0<=b&&1>=b){var e=new Float32Array(11);if(c!==d||b!==f)for(var k=0;11>k;++k)e[k]=a(.1*k,c,b);return function(k){if(c===d&&b===f)return k;if(0===k)return 0;if(1===k)return 1;for(var h=0,l=1;10!==l&&e[l]<=k;++l)h+=.1;--l;var l=h+(k-e[l])/(e[l+1]-e[l])*.1,n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(.001<=n){for(h=0;4>h;++h){n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(0===n)break;var m=a(l,c,b)-k,l=l-m/n}k=l}else if(0===
|
|
29
|
+
n)k=l;else{var l=h,h=h+.1,g=0;do m=l+(h-l)/2,n=a(m,c,b)-k,0<n?h=m:l=m;while(1e-7<Math.abs(n)&&10>++g);k=m}return a(k,d,f)}}}}(),Q=function(){function a(a,b){return 0===a||1===a?a:-Math.pow(2,10*(a-1))*Math.sin(2*(a-1-b/(2*Math.PI)*Math.asin(1))*Math.PI/b)}var c="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),d={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],a],Out:[[.25,
|
|
30
|
+
.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(b,c){return 1-a(1-b,c)}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(b,c){return.5>b?a(2*b,c)/2:1-a(-2*b+2,c)/2}]},b={linear:A(.25,.25,.75,.75)},f={},e;for(e in d)f.type=e,d[f.type].forEach(function(a){return function(d,f){b["ease"+a.type+c[f]]=h.fnc(d)?
|
|
31
|
+
d:A.apply($jscomp$this,d)}}(f)),f={type:f.type};return b}(),ha={css:function(a,c,d){return a.style[c]=d},attribute:function(a,c,d){return a.setAttribute(c,d)},object:function(a,c,d){return a[c]=d},transform:function(a,c,d,b,f){b[f]||(b[f]=[]);b[f].push(c+"("+d+")")}},v=[],B=0,ia=function(){function a(){B=requestAnimationFrame(c)}function c(c){var b=v.length;if(b){for(var d=0;d<b;)v[d]&&v[d].tick(c),d++;a()}else cancelAnimationFrame(B),B=0}return a}();q.version="2.2.0";q.speed=1;q.running=v;q.remove=
|
|
32
|
+
function(a){a=P(a);for(var c=v.length;c--;)for(var d=v[c],b=d.animations,f=b.length;f--;)u(a,b[f].animatable.target)&&(b.splice(f,1),b.length||d.pause())};q.getValue=K;q.path=function(a,c){var d=h.str(a)?e(a)[0]:a,b=c||100;return function(a){return{el:d,property:a,totalLength:N(d)*(b/100)}}};q.setDashoffset=function(a){var c=N(a);a.setAttribute("stroke-dasharray",c);return c};q.bezier=A;q.easings=Q;q.timeline=function(a){var c=q(a);c.pause();c.duration=0;c.add=function(d){c.children.forEach(function(a){a.began=
|
|
33
|
+
!0;a.completed=!0});m(d).forEach(function(b){var d=z(b,D(S,a||{}));d.targets=d.targets||a.targets;b=c.duration;var e=d.offset;d.autoplay=!1;d.direction=c.direction;d.offset=h.und(e)?b:L(e,b);c.began=!0;c.completed=!0;c.seek(d.offset);d=q(d);d.began=!0;d.completed=!0;d.duration>b&&(c.duration=d.duration);c.children.push(d)});c.seek(0);c.reset();c.autoplay&&c.restart();return c};return c};q.random=function(a,c){return Math.floor(Math.random()*(c-a+1))+a};return q});
|