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