c5169e0e
Renato De Donato
a new hope
|
1
2
|
paper-ripple
============
|
73bcce88
luigser
COMPONENTS
|
3
4
5
6
7
8
9
|
`paper-ripple` provides a visual effect that other paper elements can
use to simulate a rippling effect emanating from the point of contact. The
effect can be visualized as a concentric circle with motion.
Example:
|
c5169e0e
Renato De Donato
a new hope
|
10
11
12
|
```html
<paper-ripple></paper-ripple>
```
|
73bcce88
luigser
COMPONENTS
|
13
14
15
16
|
`paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple
effect when touches on it. You can also defeat the default behavior and
manually route the down and up actions to the ripple element. Note that it is
|
c5169e0e
Renato De Donato
a new hope
|
17
18
|
important if you call downAction() you will have to make sure to call
upAction() so that `paper-ripple` would end the animation loop.
|
73bcce88
luigser
COMPONENTS
|
19
20
21
|
Example:
|
c5169e0e
Renato De Donato
a new hope
|
22
23
24
25
26
27
28
29
30
31
32
33
|
```html
<paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple>
...
<script>
downAction: function(e) {
this.$.ripple.downAction({x: e.x, y: e.y});
},
upAction: function(e) {
this.$.ripple.upAction();
}
</script>
```
|
73bcce88
luigser
COMPONENTS
|
34
35
36
|
Styling ripple effect:
|
c5169e0e
Renato De Donato
a new hope
|
37
|
Use CSS color property to style the ripple:
|
73bcce88
luigser
COMPONENTS
|
38
|
|
c5169e0e
Renato De Donato
a new hope
|
39
40
41
42
43
|
```css
paper-ripple {
color: #4285f4;
}
```
|
73bcce88
luigser
COMPONENTS
|
44
|
|
c5169e0e
Renato De Donato
a new hope
|
45
46
|
Note that CSS color property is inherited so it is not required to set it on
the `paper-ripple` element directly.
|
73bcce88
luigser
COMPONENTS
|
47
|
|
73bcce88
luigser
COMPONENTS
|
48
|
|
c5169e0e
Renato De Donato
a new hope
|
49
|
By default, the ripple is centered on the point of contact. Apply the ``recenters`` attribute to have the ripple grow toward the center of its container.
|
73bcce88
luigser
COMPONENTS
|
50
|
|
c5169e0e
Renato De Donato
a new hope
|
51
52
53
|
```html
<paper-ripple recenters></paper-ripple>
```
|
73bcce88
luigser
COMPONENTS
|
54
|
|
c5169e0e
Renato De Donato
a new hope
|
55
|
Apply `center` to center the ripple inside its container from the start.
|
73bcce88
luigser
COMPONENTS
|
56
|
|
c5169e0e
Renato De Donato
a new hope
|
57
58
59
|
```html
<paper-ripple center></paper-ripple>
```
|
a1a3bc73
Luigi Serra
graphs updates
|
60
|
|
c5169e0e
Renato De Donato
a new hope
|
61
|
Apply `circle` class to make the rippling effect within a circle.
|
a1a3bc73
Luigi Serra
graphs updates
|
62
|
|
c5169e0e
Renato De Donato
a new hope
|
63
64
65
|
```html
<paper-ripple class="circle"></paper-ripple>
```
|