Polymer - Paper Ripple



Paper-ripple is a visual rippling effect, which can be seen when you click a button, an icon, or any element you choose to have a ripple effect. The effect looks like concentric circles with motion starting from the point of contact.

You can use this element in your application, by running the following command to install it in your project directory.

bower install --save PolymerElements/paper-ripple

Example

The following example specifies the use of paper-ripple element in Polymer.js. Create an index.html file and add the following code in it.

<!doctype html>
<html>
   <head>
      <link rel = 'import' href = 'my-app.html'>
   </head>
   
   <body>    
      <my-app></my-app>
   </body>
</html>

Now, open the my-app.html file and include the following code in it.

<link rel = 'import' href = 'bower_components/polymer/polymer.html'>
<link rel = "import" href = "bower_components/paper-ripple/paper-ripple.html">
<link rel = "import" href = "bower_components/paper-button/paper-button.html">
<link rel = "import" href = "bower_components/paper-styles/paper-styles.html">

<dom-module id = 'my-app'>
   <template>
      <style>
         .button {
            padding-left: -4px;
            background-color: #0f9d58;
            width: 150px;
            height: 42px;      
         }       
      </style>
    
      <h3>Paper-Ripple Example </h3>
      <div class = "button">
         <paper-button toggles raised>TutorialsPoint</paper-button>
         <paper-ripple></paper-ripple>
      </div>
   </template>
   
   <script>
      Polymer ({
         is: 'my-app', ready: function() {
            this.async(function() {         
            });
         }
      });
   </script>
</dom-module>

Output

To run the application, navigate to the created project directory and run the following command.

polymer serve

Now open the browser and navigate to http://127.0.0.1:8081/. Following will be the output.

Polymer Paper-Ripple
polymer_elements.htm
Advertisements