| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <!-- | |
| 3 Copyright 2013 The Polymer Authors. All rights reserved. | |
| 4 Use of this source code is governed by a BSD-style | |
| 5 license that can be found in the LICENSE file. | |
| 6 --> | |
| 7 <html> | |
| 8 <head> | |
| 9 <title>paper-shadow</title> | |
| 10 | |
| 11 <meta charset="utf-8"> | |
| 12 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| 13 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> | |
| 14 | |
| 15 <script src="../platform/platform.js"></script> | |
| 16 <link href="paper-shadow.html" rel="import"> | |
| 17 <link href="paper-shadow.css" rel="import"> | |
| 18 | |
| 19 <style> | |
| 20 body { | |
| 21 font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial; | |
| 22 transform: translateZ(0); | |
| 23 -webkit-transform: translateZ(0); | |
| 24 transform: translateZ(0); | |
| 25 padding: 16px; | |
| 26 user-select: none; | |
| 27 -webkit-user-select: none; | |
| 28 } | |
| 29 | |
| 30 section { | |
| 31 display: flex; | |
| 32 display: -webkit-flex; | |
| 33 width: 80%; | |
| 34 margin: 16px; | |
| 35 } | |
| 36 | |
| 37 aside { | |
| 38 flex: 1 1 auto; | |
| 39 -webkit-flex: 1 1 auto; | |
| 40 padding: 48px 16px; | |
| 41 user-select: text; | |
| 42 -webkit-user-select: text; | |
| 43 } | |
| 44 | |
| 45 .card { | |
| 46 background: white; | |
| 47 width: 300px; | |
| 48 height: 300px; | |
| 49 position: relative; | |
| 50 margin: 16px; | |
| 51 border-radius: 2px; | |
| 52 } | |
| 53 | |
| 54 .card-inner { | |
| 55 position: absolute; | |
| 56 left: 0; | |
| 57 top: 0; | |
| 58 right: 0; | |
| 59 bottom: 0; | |
| 60 border-radius: 2px; | |
| 61 } | |
| 62 | |
| 63 </style> | |
| 64 </head> | |
| 65 <body unresolved> | |
| 66 | |
| 67 <section> | |
| 68 <div> | |
| 69 <div class="card"> | |
| 70 </div> | |
| 71 </div> | |
| 72 <aside> | |
| 73 z-depth = 0 | |
| 74 </aside> | |
| 75 </section> | |
| 76 | |
| 77 <section> | |
| 78 <!-- Example of using paper-shadow to add a shadow to an element --> | |
| 79 <div> | |
| 80 <div class="card"> | |
| 81 <paper-shadow z="1"></paper-shadow> | |
| 82 </div> | |
| 83 </div> | |
| 84 <aside> | |
| 85 z-depth = 1 | |
| 86 </aside> | |
| 87 </section> | |
| 88 | |
| 89 <section> | |
| 90 <!-- Example of using paper-shadow as part of a Polymer element --> | |
| 91 <polymer-element name="x-card" attributes="z"> | |
| 92 <template> | |
| 93 <style> | |
| 94 :host { | |
| 95 display: block; | |
| 96 } | |
| 97 </style> | |
| 98 <paper-shadow z="{{z}}"></paper-shadow> | |
| 99 </template> | |
| 100 <script> | |
| 101 Polymer('x-card', { | |
| 102 publish: { | |
| 103 z: {value: 1, reflect: true} | |
| 104 } | |
| 105 }); | |
| 106 </script> | |
| 107 </polymer-element> | |
| 108 <div> | |
| 109 <x-card class="card" z="2"></x-card> | |
| 110 </div> | |
| 111 <aside> | |
| 112 z-depth = 2 | |
| 113 </aside> | |
| 114 </section> | |
| 115 | |
| 116 <section> | |
| 117 <!-- Example of using paper-shadow by adding a class directly --> | |
| 118 <div> | |
| 119 <div class="card paper-shadow-top-z-3"> | |
| 120 <div class="card-inner paper-shadow-bottom-z-3"> | |
| 121 </div> | |
| 122 </div> | |
| 123 </div> | |
| 124 <aside> | |
| 125 z-depth = 3 | |
| 126 </aside> | |
| 127 </section> | |
| 128 | |
| 129 <section> | |
| 130 <div> | |
| 131 <div class="card paper-shadow-top-z-4"> | |
| 132 <div class="card-inner paper-shadow-bottom-z-4"> | |
| 133 </div> | |
| 134 </div> | |
| 135 </div> | |
| 136 <aside> | |
| 137 z-depth = 4 | |
| 138 </aside> | |
| 139 </section> | |
| 140 | |
| 141 <section> | |
| 142 <div> | |
| 143 <div class="card paper-shadow-top-z-5"> | |
| 144 <div class="card-inner paper-shadow-bottom-z-5"> | |
| 145 </div> | |
| 146 </div> | |
| 147 </div> | |
| 148 <aside> | |
| 149 z-depth = 5 | |
| 150 </aside> | |
| 151 </section> | |
| 152 | |
| 153 <br> | |
| 154 <br> | |
| 155 <br> | |
| 156 <br> | |
| 157 | |
| 158 <polymer-element name="x-shadow" attributes="z" on-tap="{{tapAction}}"> | |
| 159 <template> | |
| 160 <style> | |
| 161 :host, | |
| 162 .paper-shadow-bottom { | |
| 163 display: block; | |
| 164 background: white; | |
| 165 color: #ccc; | |
| 166 } | |
| 167 | |
| 168 :host(.fab), | |
| 169 :host(.fab) .paper-shadow-bottom { | |
| 170 width: 48px; | |
| 171 height: 48px; | |
| 172 border-radius: 24px; | |
| 173 } | |
| 174 </style> | |
| 175 <paper-shadow z="{{z}}" animated></paper-shadow> | |
| 176 </template> | |
| 177 <script> | |
| 178 Polymer('x-shadow', { | |
| 179 publish: { | |
| 180 z: {value: 0, reflect: true} | |
| 181 }, | |
| 182 up: true, | |
| 183 zChanged: function() { | |
| 184 this.fire('shadow-z-changed'); | |
| 185 }, | |
| 186 tapAction: function() { | |
| 187 if (this.up) { | |
| 188 if (this.z < 5) { | |
| 189 this.z += 1; | |
| 190 } else { | |
| 191 this.z -= 1; | |
| 192 this.up = false; | |
| 193 } | |
| 194 } else { | |
| 195 if (this.z > 0) { | |
| 196 this.z -= 1; | |
| 197 } else { | |
| 198 this.z += 1; | |
| 199 this.up = true; | |
| 200 } | |
| 201 } | |
| 202 } | |
| 203 }); | |
| 204 </script> | |
| 205 </polymer-element> | |
| 206 | |
| 207 <section> | |
| 208 <div> | |
| 209 <x-shadow id="card" z="0" class="card"></x-shadow> | |
| 210 </div> | |
| 211 <aside> | |
| 212 Tap to lift/drop the card. | |
| 213 <br> | |
| 214 Current z-index = <span id="card-z">0</span> | |
| 215 </aside> | |
| 216 <script> | |
| 217 document.addEventListener('polymer-ready', function() { | |
| 218 var fab = document.getElementById('card'); | |
| 219 fab.addEventListener('shadow-z-changed', function() { | |
| 220 document.getElementById('card-z').textContent = fab.z; | |
| 221 }); | |
| 222 }); | |
| 223 </script> | |
| 224 </section> | |
| 225 | |
| 226 <section> | |
| 227 <div> | |
| 228 <style> | |
| 229 x-shadow.fab { | |
| 230 margin: 48px 142px; | |
| 231 } | |
| 232 </style> | |
| 233 <x-shadow id="fab" z="0" class="fab"></x-shadow> | |
| 234 </div> | |
| 235 <aside> | |
| 236 Tap to lift/drop the button. | |
| 237 <br> | |
| 238 Current z-index = <span id="fab-z">0</span> | |
| 239 </aside> | |
| 240 <script> | |
| 241 document.addEventListener('polymer-ready', function() { | |
| 242 var fab = document.getElementById('fab'); | |
| 243 fab.addEventListener('shadow-z-changed', function() { | |
| 244 document.getElementById('fab-z').textContent = fab.z; | |
| 245 }); | |
| 246 }); | |
| 247 </script> | |
| 248 </section> | |
| 249 | |
| 250 </body> | |
| 251 </html> | |
| OLD | NEW |