<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link href="core-transition-pages.html" rel="import">

<core-style id="cascade-transition">
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div {
    -webkit-transition: -webkit-transform {{g.transitions.cascadeDuration || g.transitions.duration}} cubic-bezier(0.4, 0, 0.2, 1), opacity {{g.transitions.cascadeFadeDuration || g.transitions.duration}} cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform {{g.transitions.cascadeDuration || g.transitions.duration}} cubic-bezier(0.4, 0, 0.2, 1), opacity {{g.transitions.cascadeFadeDuration || g.transitions.duration}} cubic-bezier(0.4, 0, 0.2, 1);
  }

  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(2)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(2) {
    -webkit-transition-delay: 0.05s;
    transition-delay: 0.05s;
  }

  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(3)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(3) {
    -webkit-transition-delay: 0.1s;
    transition-delay: 0.1s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(4)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(4) {
    -webkit-transition-delay: 0.15s;
    transition-delay: 0.15s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(5)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(5) {
    -webkit-transition-delay: 0.2s;
    transition-delay: 0.2s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(6)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(6) {
    -webkit-transition-delay: 0.25s;
    transition-delay: 0.25s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(7)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(7) {
    -webkit-transition-delay: 0.3s;
    transition-delay: 0.3s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(8)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(8) {
    -webkit-transition-delay: 0.35s;
    transition-delay: 0.35s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(9)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(9) {
    -webkit-transition-delay: 0.4s;
    transition-delay: 0.4s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(10)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(10) {
    -webkit-transition-delay: 0.45s;
    transition-delay: 0.45s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(11)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(11) {
    -webkit-transition-delay: 0.5s;
    transition-delay: 0.5s;
  }
  
  polyfill-next-selector { content: ':host(.cascade) > * [cascade] > div:nth-of-type(12)'; }
  :host(.cascade) ::content > * /deep/ [cascade] > div:nth-of-type(12) {
    -webkit-transition-delay: 0.55s;
    transition-delay: 0.55s;
  }
  
  polyfill-next-selector { content: '.core-selected [cascade] > div'; }
  ::content > .core-selected /deep/ [cascade] > div {
  }

  polyfill-next-selector { content: '[animate]:not(.core-selected) [cascade] > div'; }
  ::content > [animate]:not(.core-selected) /deep/ [cascade] > div {
    -webkit-transform: translateY(100%);
    transform: translateY(100%);
  }

  polyfill-next-selector { content: '[animate]:not(.core-selected) [cascade][fade] > div'; }
  ::content > [animate]:not(.core-selected) /deep/ [cascade][fade] > div {
    opacity: 0;
  }
</core-style>

<!--

`cascade-transition` slides the children of a container up in sequence, creating a
reverse waterfall effect. It works well with both grids and lists. Configure the
duration of the transition with the global variable `CoreStyle.g.transitions.cascadeDuration`.

Example:

    <core-animated-pages transition="cascade-transition">
      <section>
        <div id="container" cascade>
          <div>item 1</div>
          <div>item 2</div>
          <div>item 3</div>
          <div>item 4</div>
          <div>item 5</div>
          <div>item 6</div>
          <div>item 7</div>
        </div>
      </section>
      <section></section>
    </core-animated-pages>

In the above example, the immediate children of `#container` will slide up in
sequence when the page transitions from 0 to 1.

The items can optionally fade in as they slide. Add the `fade` attribute to
the container to do that and configure the duration of the opacity transition with
the global variable `CoreStyle.g.transitions.cascadeFadeDuration`.

@class cascade-transition
@extends core-transition-pages
@status beta
@homepage github.io

-->

<core-transition-pages id="cascade-transition" activeClass="cascade" transitionProperty="transform"></core-transition-pages>
