Update Polymer and pull in iron-list
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-ripple / paper-ripple.html
blobb01a42462149bc7f961179c45ef09b686fea6041
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.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
8 --><html><head><link rel="import" href="../polymer/polymer.html">
9 <link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
11 <!--
12 `paper-ripple` provides a visual effect that other paper elements can
13 use to simulate a rippling effect emanating from the point of contact. The
14 effect can be visualized as a concentric circle with motion.
16 Example:
18 <paper-ripple></paper-ripple>
20 `paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple
21 effect when touches on it. You can also defeat the default behavior and
22 manually route the down and up actions to the ripple element. Note that it is
23 important if you call downAction() you will have to make sure to call
24 upAction() so that `paper-ripple` would end the animation loop.
26 Example:
28 <paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple>
29 ...
30 downAction: function(e) {
31 this.$.ripple.downAction({x: e.x, y: e.y});
33 upAction: function(e) {
34 this.$.ripple.upAction();
37 Styling ripple effect:
39 Use CSS color property to style the ripple:
41 paper-ripple {
42 color: #4285f4;
45 Note that CSS color property is inherited so it is not required to set it on
46 the `paper-ripple` element directly.
48 By default, the ripple is centered on the point of contact. Apply the `recenters`
49 attribute to have the ripple grow toward the center of its container.
51 <paper-ripple recenters></paper-ripple>
53 You can also center the ripple inside its container from the start.
55 <paper-ripple center></paper-ripple>
57 Apply `circle` class to make the rippling effect within a circle.
59 <paper-ripple class="circle"></paper-ripple>
61 @group Paper Elements
62 @element paper-ripple
63 @hero hero.svg
64 @demo demo/index.html
65 -->
67 </head><body><dom-module id="paper-ripple">
69 <!--
70 Fired when the animation finishes. This is useful if you want to wait until the ripple
71 animation finishes to perform some action.
73 @event transitionend
74 @param {Object} detail
75 @param {Object} detail.node The animated node
76 -->
78 <template>
79 <style>
80 :host {
81 display: block;
82 position: absolute;
83 border-radius: inherit;
84 overflow: hidden;
85 top: 0;
86 left: 0;
87 right: 0;
88 bottom: 0;
91 :host([animating]) {
92 /* This resolves a rendering issue in Chrome (as of 40) where the
93 ripple is not properly clipped by its parent (which may have
94 rounded corners). See: http://jsbin.com/temexa/4
96 Note: We only apply this style conditionally. Otherwise, the browser
97 will create a new compositing layer for every ripple element on the
98 page, and that would be bad. */
99 -webkit-transform: translate(0, 0);
100 transform: translate3d(0, 0, 0);
103 :host([noink]) {
104 pointer-events: none;
107 #background,
108 #waves,
109 .wave-container,
110 .wave {
111 pointer-events: none;
112 position: absolute;
113 top: 0;
114 left: 0;
115 width: 100%;
116 height: 100%;
119 #background,
120 .wave {
121 opacity: 0;
124 #waves,
125 .wave {
126 overflow: hidden;
129 .wave-container,
130 .wave {
131 border-radius: 50%;
134 :host(.circle) #background,
135 :host(.circle) #waves {
136 border-radius: 50%;
139 :host(.circle) .wave-container {
140 overflow: hidden;
142 </style>
144 <div id="background"></div>
145 <div id="waves"></div>
146 </template>
147 </dom-module>
148 <script src="paper-ripple-extracted.js"></script></body></html>