| 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-shared-element-animatable-behavior.html"> |
| 12 |
| 13 <dom-module id="animated-grid"> |
| 14 |
| 15 <link rel="import" type="css" href="../shared.css"> |
| 16 |
| 17 <style> |
| 18 |
| 19 :host { |
| 20 display: block; |
| 21 background: #000; |
| 22 } |
| 23 |
| 24 .tile { |
| 25 display: inline-block; |
| 26 float: left; |
| 27 vertical-align: top; |
| 28 width: calc(100% / 6); |
| 29 height: calc(100% / 3); |
| 30 |
| 31 @apply(--paper-font-title); |
| 32 @apply(--layout-vertical); |
| 33 @apply(--layout-center-center); |
| 34 } |
| 35 |
| 36 .tile:nth-of-type(1) { |
| 37 width: calc(100% / 3); |
| 38 height: calc(100% / 3 * 2); |
| 39 } |
| 40 |
| 41 .tile:nth-of-type(4) { |
| 42 width: calc(100% / 3); |
| 43 } |
| 44 |
| 45 .tile:nth-of-type(5) { |
| 46 width: calc(100% / 3); |
| 47 height: calc(100% / 3 * 2); |
| 48 } |
| 49 |
| 50 .tile:nth-of-type(8) { |
| 51 width: calc(100% / 3); |
| 52 height: calc(100% / 3); |
| 53 } |
| 54 |
| 55 .tile:nth-of-type(9) { |
| 56 position: absolute; |
| 57 top: calc(100% / 3 * 2); |
| 58 left: 0; |
| 59 width: calc(100% / 6); |
| 60 height: calc(100% / 3); |
| 61 } |
| 62 |
| 63 .tile:nth-of-type(10) { |
| 64 position: absolute; |
| 65 top: calc(100% / 3 * 2); |
| 66 left: calc(100% / 6);; |
| 67 width: calc(100% / 6); |
| 68 height: calc(100% / 3); |
| 69 } |
| 70 |
| 71 </style> |
| 72 |
| 73 <template> |
| 74 |
| 75 <template is="dom-repeat" items="[[config]]"> |
| 76 <div class$="[[_computeTileClass(item.color)]]"> |
| 77 <span>[[item.value]]</span> |
| 78 </div> |
| 79 </template> |
| 80 |
| 81 </template> |
| 82 |
| 83 </dom-module> |
| 84 |
| 85 <script> |
| 86 |
| 87 Polymer({ |
| 88 |
| 89 is: 'animated-grid', |
| 90 |
| 91 behaviors: [ |
| 92 Polymer.NeonSharedElementAnimatableBehavior |
| 93 ], |
| 94 |
| 95 properties: { |
| 96 |
| 97 config: { |
| 98 type: Array, |
| 99 value: function() { |
| 100 return [ |
| 101 {value: 1, color: 'blue'}, |
| 102 {value: 2, color: 'red'}, |
| 103 {value: 3, color: 'blue'}, |
| 104 {value: 4, color: 'green'}, |
| 105 {value: 5, color: 'yellow'}, |
| 106 {value: 6, color: 'blue'}, |
| 107 {value: 7, color: 'red'}, |
| 108 {value: 8, color: 'green'}, |
| 109 {value: 9, color: 'yellow'}, |
| 110 {value: 10, color: 'red'} |
| 111 ] |
| 112 } |
| 113 }, |
| 114 |
| 115 animationConfig: { |
| 116 type: Object, |
| 117 value: function() { |
| 118 return { |
| 119 'entry': [{ |
| 120 name: 'cascaded-animation', |
| 121 animation: 'transform-animation', |
| 122 transformFrom: 'translateY(100%)', |
| 123 transformTo: 'none', |
| 124 timing: { |
| 125 delay: 50 |
| 126 } |
| 127 }] |
| 128 } |
| 129 } |
| 130 } |
| 131 |
| 132 }, |
| 133 |
| 134 attached: function() { |
| 135 this.async(function() { |
| 136 var nodeList = Polymer.dom(this.root).querySelectorAll('.tile'); |
| 137 this.animationConfig['entry'][0].nodes = Array.prototype.slice.call(node
List); |
| 138 }); |
| 139 }, |
| 140 |
| 141 _computeTileClass: function(color) { |
| 142 return 'tile ' + color + '-300'; |
| 143 } |
| 144 |
| 145 }); |
| 146 |
| 147 </script> |
| OLD | NEW |