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">
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.
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.
28 <paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple>
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:
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>
67 </head><body><dom-module id=
"paper-ripple">
70 Fired when the animation finishes. This is useful if you want to wait until the ripple
71 animation finishes to perform some action.
74 @param {Object} detail
75 @param {Object} detail.node The animated node
83 border-radius: inherit;
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);
104 pointer-events: none;
111 pointer-events: none;
134 :host(.circle) #background,
135 :host(.circle) #waves {
139 :host(.circle) .wave-container {
144 <div id=
"background"></div>
145 <div id=
"waves"></div>
148 <script src=
"paper-ripple-extracted.js"></script></body></html>