Add ICU message format support
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / neon-animation / animations / cascaded-animation-extracted.js
blobd2761228b173d9be27ddceb06340157b33e95f17
3   Polymer({
5     is: 'cascaded-animation',
7     behaviors: [
8       Polymer.NeonAnimationBehavior
9     ],
11     properties: {
13       /** @type {!Polymer.IronMeta} */
14       _animationMeta: {
15         type: Object,
16         value: function() {
17           return new Polymer.IronMeta({type: 'animation'});
18         }
19       }
21     },
23     /**
24      * @param {{
25      *   animation: string,
26      *   nodes: !Array<!Element>,
27      *   nodeDelay: (number|undefined),
28      *   timing: (Object|undefined)
29      *  }} config
30      */
31     configure: function(config) {
32       var animationConstructor = /** @type {Function} */ (
33           this._animationMeta.byKey(config.animation));
34       if (!animationConstructor) {
35         console.warn(this.is + ':', 'constructor for', config.animation, 'not found!');
36         return;
37       }
39       this._animations = [];
40       var nodes = config.nodes;
41       var effects = [];
42       var nodeDelay = config.nodeDelay || 50;
44       config.timing = config.timing || {};
45       config.timing.delay = config.timing.delay || 0;
47       var oldDelay = config.timing.delay;
48       for (var node, index = 0; node = nodes[index]; index++) {
49         config.timing.delay += nodeDelay;
50         config.node = node;
52         var animation = new animationConstructor();
53         var effect = animation.configure(config);
55         this._animations.push(animation);
56         effects.push(effect);
57       }
58       config.timing.delay = oldDelay;
60       this._effect = new GroupEffect(effects);
61       return this._effect;
62     },
64     complete: function() {
65       for (var animation, index = 0; animation = this._animations[index]; index++) {
66         animation.complete(animation.config);
67       }
68     }
70   });