OLD | NEW |
| (Empty) |
1 | |
2 | |
3 Polymer({ | |
4 | |
5 is: 'cascaded-animation', | |
6 | |
7 behaviors: [ | |
8 Polymer.NeonAnimationBehavior | |
9 ], | |
10 | |
11 properties: { | |
12 | |
13 _animationMeta: { | |
14 type: Object, | |
15 value: function() { | |
16 return new Polymer.IronMeta({type: 'animation'}); | |
17 } | |
18 } | |
19 | |
20 }, | |
21 | |
22 configure: function(config) { | |
23 var animationConstructor = this._animationMeta.byKey(config.animation); | |
24 if (!animationConstructor) { | |
25 console.warn(this.is + ':', 'constructor for', config.animation, 'not fo
und!'); | |
26 return; | |
27 } | |
28 | |
29 var nodes = config.nodes; | |
30 var effects = []; | |
31 var nodeDelay = config.nodeDelay || 50; | |
32 | |
33 config.timing = config.timing || {}; | |
34 config.timing.delay = config.timing.delay || 0; | |
35 | |
36 var oldDelay = config.timing.delay; | |
37 for (var node, index = 0; node = nodes[index]; index++) { | |
38 config.timing.delay += nodeDelay; | |
39 config.node = node; | |
40 | |
41 var animation = new animationConstructor(); | |
42 var effect = animation.configure(config); | |
43 | |
44 effects.push(effect); | |
45 } | |
46 config.timing.delay = oldDelay; | |
47 | |
48 this._effect = new GroupEffect(effects); | |
49 return this._effect; | |
50 } | |
51 | |
52 }); | |
53 | |
OLD | NEW |