Home | History | Annotate | Download | only in paper-ripple
      1 
      2 <!---
      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 The bot does some handling of markdown. Please file a bug if it does the wrong
     11 thing! 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 
     22 Material 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
     25 use to simulate a rippling effect emanating from the point of contact.  The
     26 effect can be visualized as a concentric circle with motion.
     27 
     28 Example:
     29 
     30 ```html
     31 <div style="position:relative">
     32   <paper-ripple></paper-ripple>
     33 </div>
     34 ```
     35 
     36 Note, it's important that the parent container of the ripple be relative position, otherwise
     37 the ripple will emanate outside of the desired container.
     38 
     39 `paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple
     40 effect when touches on it.  You can also defeat the default behavior and
     41 manually route the down and up actions to the ripple element.  Note that it is
     42 important if you call `downAction()` you will have to make sure to call
     43 `upAction()` so that `paper-ripple` would end the animation loop.
     44 
     45 Example:
     46 
     47 ```html
     48 <paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple>
     49 ...
     50 downAction: function(e) {
     51   this.$.ripple.downAction({detail: {x: e.x, y: e.y}});
     52 },
     53 upAction: function(e) {
     54   this.$.ripple.upAction();
     55 }
     56 ```
     57 
     58 Styling ripple effect:
     59 
     60   Use CSS color property to style the ripple:
     61 
     62 ```css
     63 paper-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 
     71 By default, the ripple is centered on the point of contact.  Apply the `recenters`
     72 attribute to have the ripple grow toward the center of its container.
     73 
     74 ```html
     75 <paper-ripple recenters></paper-ripple>
     76 ```
     77 
     78 You can also  center the ripple inside its container from the start.
     79 
     80 ```html
     81 <paper-ripple center></paper-ripple>
     82 ```
     83 
     84 Apply `circle` class to make the rippling effect within a circle.
     85 
     86 ```html
     87 <paper-ripple class="circle"></paper-ripple>
     88 ```
     89 
     90 
     91