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.github.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/CONTRIBUTORS.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/PATENTS.txt
10 <link href=
"core-transition-pages.html" rel=
"import">
12 <core-style id=
"cross-fade">
13 polyfill-next-selector { content: ':host
> * [cross-fade]'; }
14 ::content
> * /deep/ [cross-fade] {
15 -webkit-transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} cubic-bezier(
0.4,
0,
0.2,
1);
16 transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} cubic-bezier(
0.4,
0,
0.2,
1);
19 polyfill-next-selector { content: ':host
> * [cross-fade][bg]'; }
20 ::content
> * /deep/ [cross-fade][bg] {
21 -webkit-transition: background-color {{g.transitions.xfadeDuration || g.transitions.duration}} cubic-bezier(
0.4,
0,
0.2,
1);
22 transition: background-color {{g.transitions.xfadeDuration || g.transitions.duration}} cubic-bezier(
0.4,
0,
0.2,
1);
25 polyfill-next-selector { content: ':host
> * [cross-fade][hero-p]'; }
26 ::content
> * /deep/ [cross-fade][hero-p] {
27 -webkit-transition: background-color {{g.transitions.xfadeDuration || g.transitions.duration}} cubic-bezier(
0.4,
0,
0.2,
1);
28 transition: background-color {{g.transitions.xfadeDuration || g.transitions.duration}} cubic-bezier(
0.4,
0,
0.2,
1);
31 polyfill-next-selector { content: ':host
> .core-selected [cross-fade]'; }
32 ::content
> .core-selected /deep/ [cross-fade] {
36 polyfill-next-selector { content: ':host
> [animate]:not(.core-selected) [cross-fade]:not([hero-p]):not([bg])'; }
37 ::content
> [animate]:not(.core-selected) /deep/ [cross-fade]:not([hero-p]):not([bg]) {
41 polyfill-next-selector { content: ':host
> [animate]:not(.core-selected) [cross-fade][bg]'; }
42 ::content
> [animate]:not(.core-selected) /deep/ [cross-fade][bg] {
43 background-color: rgba(
0,
0,
0,
0);
46 polyfill-next-selector { content: ':host
> [animate]:not(.core-selected) [cross-fade][hero-p]'; }
47 ::content
> [animate]:not(.core-selected) /deep/ [cross-fade][hero-p] {
48 background-color: rgba(
0,
0,
0,
0);
52 <core-style id=
"cross-fade-delayed">
53 polyfill-next-selector { content: ':host
> * [cross-fade-delayed]'; }
54 ::content
> * /deep/ [cross-fade-delayed] {
55 -webkit-transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out;
56 transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out;
59 polyfill-next-selector { content: ':host
> .core-selected [cross-fade-delayed]'; }
60 ::content
> .core-selected /deep/ [cross-fade-delayed] {
61 -webkit-transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out {{g.transitions.xfadeDelay || g.transitions.xfadeDuration || g.transitions.duration}};
62 transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out {{g.transitions.xfadeDelay || g.transitions.xfadeDuration || g.transitions.duration}};
65 polyfill-next-selector { content: ':host
> [animate]:not(.core-selected) [cross-fade-delayed]'; }
66 ::content
> [animate]:not(.core-selected) /deep/ [cross-fade-delayed] {
70 polyfill-next-selector { content: ':host
> .core-selected [cross-fade-delayed]'; }
71 ::content
> .core-selected /deep/ [cross-fade-delayed] {
77 <core-style id=
"cross-fade-all">
78 /* cross-fade-all: cross fade everything except for heroes and their parents */
79 polyfill-next-selector { content: ':host(.cross-fade-all)
> * *:not([hero]):not([hero-p]):not([cross-fade])'; }
80 :host(.cross-fade-all) ::content
> * /deep/ *:not([hero]):not([hero-p]):not([cross-fade]) {
81 -webkit-transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out;
82 transition: opacity {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out;
85 polyfill-next-selector { content: ':host(.cross-fade-all)
> [animate]:not(.core-selected) *:not([hero]):not([hero-p]):not([cross-fade])'; }
86 :host(.cross-fade-all) ::content
> [animate]:not(.core-selected) /deep/ *:not([hero]):not([hero-p]):not([cross-fade]) {
90 polyfill-next-selector { content: ':host(.cross-fade-all)
> .core-selected *:not([hero])'; }
91 .host(.cross-fade-all) ::content
> .core-selected /deep/ * {
95 /* Only background-color is allowed for the hero's parents, no opacity transitions */
96 polyfill-next-selector { content: ':host(.cross-fade-all)
> * [hero-p]'; }
97 :host(.cross-fade-all) ::content
> * /deep/ [hero-p] {
98 -webkit-transition: background-color {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out;
99 transition: background-color {{g.transitions.xfadeDuration || g.transitions.duration}} ease-out;
103 polyfill-next-selector { content: ':host(.cross-fade-all)
> [animate]:not(.core-selected) [hero-p]'; }
104 :host(.cross-fade-all) ::content
> [animate]:not(.core-selected) /deep/ [hero-p] {
105 background-color: rgba(
0,
0,
0,
0);
111 `cross-fade` fades out elements in the outgoing page and fades in elements in the
112 incoming page during a page transition. You can configure the duration of the
113 transition with the global variable `CoreStyle.g.transitions.xfadeDuration`.
117 <core-animated-pages transition="cross-fade">
119 <div id="div1" cross-fade></div>
122 <div id="div2" cross-fade bg>
123 <div id="div3" cross-fade></div>
124 <div id="div4"></div>
127 </core-animated-pages>
129 In the above example, `#div1` and `#div3` has the `cross-fade` attribute. `#div1`
130 will fade out and `#div3` will fade in with opacity transitions when the page switches
131 from 0 to 1. Sometimes, you may want to only fade the background color of an element
132 but not its children, and you can use the `bg` attribute along with the `#div1`
133 attribute as in `#div2`.
136 @extends core-transition-pages
144 `cross-fade-delayed` performs a cross-fade after some delay, either specified in
145 the global variable `CoreStyle.g.transitions.xfadeDelay` or the duration of the
150 <core-animated-pages transition="hero-transition cross-fade-delayed">
152 <div id="div1" hero-id hero></div>
155 <div id="div2" hero-id hero>
156 <div id="div3" cross-fade-delayed></div>
159 </core-animated-pages>
161 In the above example, `#div3` fades in after the hero transition from `#div1` to
164 @class cross-fade-delayed
165 @extends core-transition-pages
171 <core-transition-pages id=
"cross-fade"></core-transition-pages>
172 <core-transition-pages id=
"cross-fade-delayed"></core-transition-pages>
173 <core-transition-pages id=
"cross-fade-all" scopeClass=
"cross-fade-all"></core-transition-pages>