OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2014 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 |
| 10 <link href="core-transition-pages.html" rel="import"> |
| 11 |
| 12 <core-style id="hero-transition"> |
| 13 /* Hide heroes that are not currently transitioning */ |
| 14 polyfill-next-selector { content: ':host > [animate]:not(.core-selecte
d) [hero]'; } |
| 15 ::content > [animate]:not(.core-selected) /deep/ [hero] { |
| 16 opacity: 0; |
| 17 } |
| 18 |
| 19 polyfill-next-selector { content: ':host > .core-selected[animate] [he
ro]'; } |
| 20 ::content > .core-selected[animate] /deep/ [hero] { |
| 21 opacity: 1; |
| 22 z-index: 10000; |
| 23 } |
| 24 |
| 25 polyfill-next-selector { content: ':host > * [hero-p]'; } |
| 26 ::content > * /deep/ [hero-p] { |
| 27 -webkit-transition: box-shadow 100ms ease-out; |
| 28 transition: box-shadow 100ms ease-out; |
| 29 } |
| 30 |
| 31 polyfill-next-selector { content: ':host > [animate] [hero-p]'; } |
| 32 ::content > [animate] /deep/ [hero-p] { |
| 33 box-shadow: none !important; |
| 34 } |
| 35 </core-style> |
| 36 |
| 37 |
| 38 <!-- |
| 39 |
| 40 `hero-transition` transforms two elements in different pages such that they appe
ar |
| 41 to be shared across the pages. |
| 42 |
| 43 Example: |
| 44 |
| 45 <core-animated-pages transition="hero-transition"> |
| 46 <section layout horizontal> |
| 47 <div id="div1" flex></div> |
| 48 <div id="div2" flex hero-id="shared" hero></div> |
| 49 </section> |
| 50 <section> |
| 51 <section layout horizontal> |
| 52 <div id="div3" flex hero-id="shared" hero></div> |
| 53 <div id="div4" flex></div> |
| 54 </section> |
| 55 </section> |
| 56 </core-animated-pages> |
| 57 |
| 58 In the above example, the elements `#div2` and `#div3` shares the same `hero-id` |
| 59 attribute and a single element appears to translate and scale smoothly between |
| 60 the two positions during a page transition. |
| 61 |
| 62 Both elements from the source and destination pages must share the same `hero-id
` |
| 63 and must both contain the `hero` attribute to trigger the transition. The separa
te |
| 64 `hero` attribute allows you to use binding to configure the transition: |
| 65 |
| 66 Example: |
| 67 |
| 68 <core-animated-pages transition="hero-transition"> |
| 69 <section layout horizontal> |
| 70 <div id="div1" flex hero-id="shared" hero?="{{selected == 0}}"></div> |
| 71 <div id="div2" flex hero-id="shared" hero?="{{selected == 1}}"></div> |
| 72 </section> |
| 73 <section> |
| 74 <section layout horizontal> |
| 75 <div id="div3" flex hero-id="shared" hero></div> |
| 76 </section> |
| 77 </section> |
| 78 </core-animated-pages> |
| 79 |
| 80 In the above example, either `#div1` or `#div2` scales to `#div3` during a page
transition, |
| 81 depending on the value of `selected`. |
| 82 |
| 83 Because it is common to share elements with different `border-radius` values, by
default |
| 84 this transition will also animate the `border-radius` property. |
| 85 |
| 86 You can configure the duration of the hero transition with the global variable |
| 87 `CoreStyle.g.transitions.heroDuration`. |
| 88 |
| 89 @class hero-transition |
| 90 @extends core-transition-pages |
| 91 @status beta |
| 92 @homepage github.io |
| 93 --> |
| 94 <polymer-element name="hero-transition" extends="core-transition-pages" assetpat
h=""> |
| 95 |
| 96 </polymer-element> |
| 97 |
| 98 <hero-transition id="hero-transition"></hero-transition> |
| 99 <script src="hero-transition-extracted.js"></script> |
OLD | NEW |