| OLD | NEW |
| 1 /** | 1 /** |
| 2 * `Polymer.NeonAnimationRunnerBehavior` adds a method to run animations. | 2 * `Polymer.NeonAnimationRunnerBehavior` adds a method to run animations. |
| 3 * | 3 * |
| 4 * @polymerBehavior Polymer.NeonAnimationRunnerBehavior | 4 * @polymerBehavior Polymer.NeonAnimationRunnerBehavior |
| 5 */ | 5 */ |
| 6 Polymer.NeonAnimationRunnerBehaviorImpl = { | 6 Polymer.NeonAnimationRunnerBehaviorImpl = { |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 | 9 |
| 10 _animationMeta: { | |
| 11 type: Object, | |
| 12 value: function() { | |
| 13 return new Polymer.IronMeta({type: 'animation'}); | |
| 14 } | |
| 15 }, | |
| 16 | |
| 17 /** @type {?Object} */ | 10 /** @type {?Object} */ |
| 18 _player: { | 11 _player: { |
| 19 type: Object | 12 type: Object |
| 20 } | 13 } |
| 21 | 14 |
| 22 }, | 15 }, |
| 23 | 16 |
| 24 _configureAnimationEffects: function(allConfigs) { | 17 _configureAnimationEffects: function(allConfigs) { |
| 25 var allAnimations = []; | 18 var allAnimations = []; |
| 26 if (allConfigs.length > 0) { | 19 if (allConfigs.length > 0) { |
| 27 for (var config, index = 0; config = allConfigs[index]; index++) { | 20 for (var config, index = 0; config = allConfigs[index]; index++) { |
| 28 var animationConstructor = this._animationMeta.byKey(config.name); | 21 var animation = document.createElement(config.name); |
| 29 if (animationConstructor) { | 22 // is this element actually a neon animation? |
| 30 var animation = animationConstructor && new animationConstructor(); | 23 if (animation.isNeonAnimation) { |
| 31 var effect = animation.configure(config); | 24 var effect = animation.configure(config); |
| 32 if (effect) { | 25 if (effect) { |
| 33 allAnimations.push({ | 26 allAnimations.push({ |
| 34 animation: animation, | 27 animation: animation, |
| 35 config: config, | 28 config: config, |
| 36 effect: effect | 29 effect: effect |
| 37 }); | 30 }); |
| 38 } | 31 } |
| 39 } else { | 32 } else { |
| 40 console.warn(this.is + ':', config.name, 'not found!'); | 33 Polymer.Base._warn(this.is + ':', config.name, 'not found!'); |
| 41 } | 34 } |
| 42 } | 35 } |
| 43 } | 36 } |
| 44 return allAnimations; | 37 return allAnimations; |
| 45 }, | 38 }, |
| 46 | 39 |
| 47 _runAnimationEffects: function(allEffects) { | 40 _runAnimationEffects: function(allEffects) { |
| 48 return document.timeline.play(new GroupEffect(allEffects)); | 41 return document.timeline.play(new GroupEffect(allEffects)); |
| 49 }, | 42 }, |
| 50 | 43 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 this._player.cancel(); | 88 this._player.cancel(); |
| 96 } | 89 } |
| 97 } | 90 } |
| 98 }; | 91 }; |
| 99 | 92 |
| 100 /** @polymerBehavior Polymer.NeonAnimationRunnerBehavior */ | 93 /** @polymerBehavior Polymer.NeonAnimationRunnerBehavior */ |
| 101 Polymer.NeonAnimationRunnerBehavior = [ | 94 Polymer.NeonAnimationRunnerBehavior = [ |
| 102 Polymer.NeonAnimatableBehavior, | 95 Polymer.NeonAnimatableBehavior, |
| 103 Polymer.NeonAnimationRunnerBehaviorImpl | 96 Polymer.NeonAnimationRunnerBehaviorImpl |
| 104 ]; | 97 ]; |
| OLD | NEW |