| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> |
| 9 <link rel="import" href="../../../polymer/polymer.html"> |
| 10 <link rel="import" href="../../../paper-styles/paper-styles.html"> |
| 11 <link rel="import" href="../../neon-animation-runner-behavior.html"> |
| 12 |
| 13 |
| 14 <dom-module id="animated-dropdown"> |
| 15 |
| 16 <style> |
| 17 |
| 18 :host { |
| 19 display: none; |
| 20 padding: 16px; |
| 21 background: white; |
| 22 color: black; |
| 23 |
| 24 @apply(--shadow-elevation-2dp); |
| 25 } |
| 26 |
| 27 </style> |
| 28 |
| 29 <template> |
| 30 |
| 31 <content></content> |
| 32 |
| 33 </template> |
| 34 |
| 35 </dom-module> |
| 36 |
| 37 <script> |
| 38 |
| 39 Polymer({ |
| 40 |
| 41 is: 'animated-dropdown', |
| 42 |
| 43 behaviors: [ |
| 44 Polymer.NeonAnimationRunnerBehavior |
| 45 ], |
| 46 |
| 47 properties: { |
| 48 |
| 49 animationConfig: { |
| 50 type: Object, |
| 51 value: function() { |
| 52 return { |
| 53 'entry': [{ |
| 54 name: 'scale-up-animation', |
| 55 node: this, |
| 56 transformOrigin: '0 0' |
| 57 }], |
| 58 'exit': [{ |
| 59 name: 'fade-out-animation', |
| 60 node: this |
| 61 }] |
| 62 } |
| 63 } |
| 64 }, |
| 65 |
| 66 _showing: { |
| 67 type: Boolean, |
| 68 value: false |
| 69 } |
| 70 |
| 71 }, |
| 72 |
| 73 listeners: { |
| 74 'neon-animation-finish': '_onAnimationFinish' |
| 75 }, |
| 76 |
| 77 _onAnimationFinish: function() { |
| 78 if (this._showing) { |
| 79 } else { |
| 80 this.style.display = ''; |
| 81 } |
| 82 }, |
| 83 |
| 84 show: function() { |
| 85 this.style.display = 'inline-block'; |
| 86 this._showing = true; |
| 87 this.playAnimation('entry'); |
| 88 }, |
| 89 |
| 90 hide: function() { |
| 91 this._showing = false; |
| 92 this.playAnimation('exit'); |
| 93 } |
| 94 |
| 95 }); |
| 96 |
| 97 </script> |
| OLD | NEW |