• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2<!---
3
4This README is automatically generated from the comments in these files:
5paper-ripple.html
6
7Edit those files, and our readme bot will duplicate them over here!
8Edit this file, and the bot will squash your changes :)
9
10The bot does some handling of markdown. Please file a bug if it does the wrong
11thing! https://github.com/PolymerLabs/tedium/issues
12
13-->
14
15[![Build status](https://travis-ci.org/PolymerElements/paper-ripple.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-ripple)
16
17_[Demo and API docs](https://elements.polymer-project.org/elements/paper-ripple)_
18
19
20##&lt;paper-ripple&gt;
21
22Material design: [Surface reaction](https://www.google.com/design/spec/animation/responsive-interaction.html#responsive-interaction-surface-reaction)
23
24`paper-ripple` provides a visual effect that other paper elements can
25use to simulate a rippling effect emanating from the point of contact.  The
26effect can be visualized as a concentric circle with motion.
27
28Example:
29
30```html
31<div style="position:relative">
32  <paper-ripple></paper-ripple>
33</div>
34```
35
36Note, it's important that the parent container of the ripple be relative position, otherwise
37the ripple will emanate outside of the desired container.
38
39`paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple
40effect when touches on it.  You can also defeat the default behavior and
41manually route the down and up actions to the ripple element.  Note that it is
42important if you call `downAction()` you will have to make sure to call
43`upAction()` so that `paper-ripple` would end the animation loop.
44
45Example:
46
47```html
48<paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple>
49...
50downAction: function(e) {
51  this.$.ripple.downAction({detail: {x: e.x, y: e.y}});
52},
53upAction: function(e) {
54  this.$.ripple.upAction();
55}
56```
57
58Styling ripple effect:
59
60  Use CSS color property to style the ripple:
61
62```css
63paper-ripple {
64  color: #4285f4;
65}
66```
67
68  Note that CSS color property is inherited so it is not required to set it on
69  the `paper-ripple` element directly.
70
71By default, the ripple is centered on the point of contact.  Apply the `recenters`
72attribute to have the ripple grow toward the center of its container.
73
74```html
75<paper-ripple recenters></paper-ripple>
76```
77
78You can also  center the ripple inside its container from the start.
79
80```html
81<paper-ripple center></paper-ripple>
82```
83
84Apply `circle` class to make the rippling effect within a circle.
85
86```html
87<paper-ripple class="circle"></paper-ripple>
88```
89
90
91