| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 Polymer({ | 33 Polymer({ |
| 34 | 34 |
| 35 is: 'cascaded-animation', | 35 is: 'cascaded-animation', |
| 36 | 36 |
| 37 behaviors: [ | 37 behaviors: [ |
| 38 Polymer.NeonAnimationBehavior | 38 Polymer.NeonAnimationBehavior |
| 39 ], | 39 ], |
| 40 | 40 |
| 41 properties: { | 41 properties: { |
| 42 | 42 |
| 43 /** @type {!Polymer.IronMeta} */ |
| 43 _animationMeta: { | 44 _animationMeta: { |
| 44 type: Object, | 45 type: Object, |
| 45 value: function() { | 46 value: function() { |
| 46 return new Polymer.IronMeta({type: 'animation'}); | 47 return new Polymer.IronMeta({type: 'animation'}); |
| 47 } | 48 } |
| 48 } | 49 } |
| 49 | 50 |
| 50 }, | 51 }, |
| 51 | 52 |
| 53 /** |
| 54 * @param {{ |
| 55 * animation: string, |
| 56 * nodes: !Array<!Element>, |
| 57 * nodeDelay: (number|undefined), |
| 58 * timing: (Object|undefined) |
| 59 * }} config |
| 60 */ |
| 52 configure: function(config) { | 61 configure: function(config) { |
| 53 var animationConstructor = this._animationMeta.byKey(config.animation); | 62 var animationConstructor = /** @type {Function} */ ( |
| 63 this._animationMeta.byKey(config.animation)); |
| 54 if (!animationConstructor) { | 64 if (!animationConstructor) { |
| 55 console.warn(this.is + ':', 'constructor for', config.animation, 'not fo
und!'); | 65 console.warn(this.is + ':', 'constructor for', config.animation, 'not fo
und!'); |
| 56 return; | 66 return; |
| 57 } | 67 } |
| 58 | 68 |
| 69 this._animations = []; |
| 59 var nodes = config.nodes; | 70 var nodes = config.nodes; |
| 60 var effects = []; | 71 var effects = []; |
| 61 var nodeDelay = config.nodeDelay || 50; | 72 var nodeDelay = config.nodeDelay || 50; |
| 62 | 73 |
| 63 config.timing = config.timing || {}; | 74 config.timing = config.timing || {}; |
| 64 config.timing.delay = config.timing.delay || 0; | 75 config.timing.delay = config.timing.delay || 0; |
| 65 | 76 |
| 66 var oldDelay = config.timing.delay; | 77 var oldDelay = config.timing.delay; |
| 67 for (var node, index = 0; node = nodes[index]; index++) { | 78 for (var node, index = 0; node = nodes[index]; index++) { |
| 68 config.timing.delay += nodeDelay; | 79 config.timing.delay += nodeDelay; |
| 69 config.node = node; | 80 config.node = node; |
| 70 | 81 |
| 71 var animation = new animationConstructor(); | 82 var animation = new animationConstructor(); |
| 72 var effect = animation.configure(config); | 83 var effect = animation.configure(config); |
| 73 | 84 |
| 85 this._animations.push(animation); |
| 74 effects.push(effect); | 86 effects.push(effect); |
| 75 } | 87 } |
| 76 config.timing.delay = oldDelay; | 88 config.timing.delay = oldDelay; |
| 77 | 89 |
| 78 this._effect = new GroupEffect(effects); | 90 this._effect = new GroupEffect(effects); |
| 79 return this._effect; | 91 return this._effect; |
| 92 }, |
| 93 |
| 94 complete: function() { |
| 95 for (var animation, index = 0; animation = this._animations[index]; index+
+) { |
| 96 animation.complete(animation.config); |
| 97 } |
| 80 } | 98 } |
| 81 | 99 |
| 82 }); | 100 }); |
| 83 | 101 |
| 84 </script> | 102 </script> |
| OLD | NEW |