| OLD | NEW |
| 1 | 1 |
| 2 | 2 |
| 3 /** | 3 /** |
| 4 * `Polymer.NeonAnimationRunnerBehavior` adds a method to run animations. | 4 * `Polymer.NeonAnimationRunnerBehavior` adds a method to run animations. |
| 5 * @polymerBehavior | 5 * |
| 6 * @polymerBehavior Polymer.NeonAnimationRunnerBehavior |
| 6 */ | 7 */ |
| 7 Polymer.NeonAnimationRunnerBehavior = [Polymer.NeonAnimatableBehavior, { | 8 Polymer.NeonAnimationRunnerBehaviorImpl = { |
| 8 | 9 |
| 9 properties: { | 10 properties: { |
| 10 | 11 |
| 11 _animationMeta: { | 12 _animationMeta: { |
| 12 type: Object, | 13 type: Object, |
| 13 value: function() { | 14 value: function() { |
| 14 return new Polymer.IronMeta({type: 'animation'}); | 15 return new Polymer.IronMeta({type: 'animation'}); |
| 15 } | 16 } |
| 16 }, | 17 }, |
| 17 | 18 |
| 19 /** @type {?Object} */ |
| 18 _player: { | 20 _player: { |
| 19 type: Object | 21 type: Object |
| 20 } | 22 } |
| 21 | 23 |
| 22 }, | 24 }, |
| 23 | 25 |
| 24 _configureAnimationEffects: function(allConfigs) { | 26 _configureAnimationEffects: function(allConfigs) { |
| 25 var allAnimations = []; | 27 var allAnimations = []; |
| 26 if (allConfigs.length > 0) { | 28 if (allConfigs.length > 0) { |
| 27 for (var config, index = 0; config = allConfigs[index]; index++) { | 29 for (var config, index = 0; config = allConfigs[index]; index++) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 } | 40 } |
| 39 } else { | 41 } else { |
| 40 console.warn(this.is + ':', config.name, 'not found!'); | 42 console.warn(this.is + ':', config.name, 'not found!'); |
| 41 } | 43 } |
| 42 } | 44 } |
| 43 } | 45 } |
| 44 return allAnimations; | 46 return allAnimations; |
| 45 }, | 47 }, |
| 46 | 48 |
| 47 _runAnimationEffects: function(allEffects) { | 49 _runAnimationEffects: function(allEffects) { |
| 48 return player = document.timeline.play(new GroupEffect(allEffects)); | 50 return document.timeline.play(new GroupEffect(allEffects)); |
| 49 }, | 51 }, |
| 50 | 52 |
| 51 _completeAnimations: function(allAnimations) { | 53 _completeAnimations: function(allAnimations) { |
| 52 for (var animation, index = 0; animation = allAnimations[index]; index++)
{ | 54 for (var animation, index = 0; animation = allAnimations[index]; index++)
{ |
| 53 animation.animation.complete(animation.config); | 55 animation.animation.complete(animation.config); |
| 54 } | 56 } |
| 55 }, | 57 }, |
| 56 | 58 |
| 57 /** | 59 /** |
| 58 * Plays an animation with an optional `type`. | 60 * Plays an animation with an optional `type`. |
| 61 * @param {string=} type |
| 62 * @param {!Object=} cookie |
| 59 */ | 63 */ |
| 60 playAnimation: function(type, cookie) { | 64 playAnimation: function(type, cookie) { |
| 61 var allConfigs = this.getAnimationConfig(type); | 65 var allConfigs = this.getAnimationConfig(type); |
| 62 if (!allConfigs) { | 66 if (!allConfigs) { |
| 63 return; | 67 return; |
| 64 } | 68 } |
| 65 var allAnimations = this._configureAnimationEffects(allConfigs); | 69 var allAnimations = this._configureAnimationEffects(allConfigs); |
| 66 var allEffects = allAnimations.map(function(animation) { | 70 var allEffects = allAnimations.map(function(animation) { |
| 67 return animation.effect; | 71 return animation.effect; |
| 68 }); | 72 }); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 }, | 90 }, |
| 87 | 91 |
| 88 /** | 92 /** |
| 89 * Cancels the currently running animation. | 93 * Cancels the currently running animation. |
| 90 */ | 94 */ |
| 91 cancelAnimation: function() { | 95 cancelAnimation: function() { |
| 92 if (this._player) { | 96 if (this._player) { |
| 93 this._player.cancel(); | 97 this._player.cancel(); |
| 94 } | 98 } |
| 95 } | 99 } |
| 100 }; |
| 96 | 101 |
| 97 }]; | 102 /** @polymerBehavior Polymer.NeonAnimationRunnerBehavior */ |
| 103 Polymer.NeonAnimationRunnerBehavior = [ |
| 104 Polymer.NeonAnimatableBehavior, |
| 105 Polymer.NeonAnimationRunnerBehaviorImpl |
| 106 ]; |
| OLD | NEW |