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="../../neon-shared-element-animatable-behavior.html"> |
| 11 |
| 12 |
| 13 <dom-module id="fullsize-page-with-card"> |
| 14 |
| 15 <link rel="import" type="css" href="../shared.css"> |
| 16 |
| 17 <style> |
| 18 |
| 19 :host { |
| 20 display: block; |
| 21 } |
| 22 |
| 23 .fixed { |
| 24 position: fixed; |
| 25 top: 0; |
| 26 left: 0; |
| 27 height: 100vh; |
| 28 width: 100vw; |
| 29 } |
| 30 |
| 31 .card { |
| 32 position: relative; |
| 33 margin: 200px 100px 0; |
| 34 height: 700px; |
| 35 } |
| 36 |
| 37 </style> |
| 38 |
| 39 <template> |
| 40 |
| 41 <div id="fixed" class$="[[_computeFixedBackgroundClass(color)]]"></div> |
| 42 |
| 43 <div id="card" class$="[[_computeCardClass(color)]]"></div> |
| 44 |
| 45 </template> |
| 46 |
| 47 </dom-module> |
| 48 |
| 49 <script> |
| 50 |
| 51 Polymer({ |
| 52 |
| 53 is: 'fullsize-page-with-card', |
| 54 |
| 55 behaviors: [ |
| 56 Polymer.NeonSharedElementAnimatableBehavior |
| 57 ], |
| 58 |
| 59 properties: { |
| 60 |
| 61 color: { |
| 62 type: String |
| 63 }, |
| 64 |
| 65 sharedElements: { |
| 66 type: Object, |
| 67 value: function() { |
| 68 return { |
| 69 'hero': this.$.card, |
| 70 'ripple': this.$.fixed |
| 71 } |
| 72 } |
| 73 }, |
| 74 |
| 75 animationConfig: { |
| 76 type: Object, |
| 77 value: function() { |
| 78 return { |
| 79 'entry': [{ |
| 80 name: 'ripple-animation', |
| 81 id: 'ripple', |
| 82 toPage: this, |
| 83 }, { |
| 84 name: 'hero-animation', |
| 85 id: 'hero', |
| 86 toPage: this, |
| 87 timing: { |
| 88 delay: 150 |
| 89 } |
| 90 }], |
| 91 'exit': [{ |
| 92 name: 'fade-out-animation', |
| 93 node: this.$.fixed |
| 94 }, { |
| 95 name: 'transform-animation', |
| 96 transformFrom: 'none', |
| 97 transformTo: 'translate(0px,-200vh) scale(0.9,1)', |
| 98 node: this.$.card |
| 99 }] |
| 100 } |
| 101 } |
| 102 } |
| 103 |
| 104 }, |
| 105 |
| 106 _computeCardClass: function(color) { |
| 107 var cls = 'card'; |
| 108 if (color) { |
| 109 cls += ' ' + color + '-300'; |
| 110 } |
| 111 return cls; |
| 112 }, |
| 113 |
| 114 _computeFixedBackgroundClass: function(color) { |
| 115 var cls = 'fixed'; |
| 116 if (color) { |
| 117 cls += ' ' + color + '-100'; |
| 118 } |
| 119 return cls; |
| 120 } |
| 121 |
| 122 }); |
| 123 |
| 124 </script> |
OLD | NEW |