Polymer-paper-ripple

提供:Dev Guides
移動先:案内検索

ポリマー-紙さざ波

紙さざ波は視覚的な波打つ効果であり、ボタン、アイコン、または波紋効果を持つように選択した要素をクリックすると表示されます。 効果は、接触点から始まる動きを伴う同心円のように見えます。

次のコマンドを実行してプロジェクトディレクトリにインストールすることにより、アプリケーションでこの要素を使用できます。

bower install --save PolymerElements/paper-ripple

次の例では、Polymer.jsでpaper-ripple要素の使用を指定しています。 indexlファイルを作成し、その中に次のコードを追加します。

<!doctype html>
<html>
   <head>
      <link rel = 'import' href = 'my-appl'>
   </head>

   <body>
      <my-app></my-app>
   </body>
</html>

次に、my-applファイルを開き、次のコードを含めます。

<link rel = 'import' href = 'bower_components/polymer/polymerl'>
<link rel = "import" href = "bower_components/paper-ripple/paper-ripplel">
<link rel = "import" href = "bower_components/paper-button/paper-buttonl">
<link rel = "import" href = "bower_components/paper-styles/paper-stylesl">

<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>finddevguides</paper-button>
         <paper-ripple></paper-ripple>
      </div>
   </template>

   <script>
      Polymer ({
         is: 'my-app', ready: function() {
            this.async(function() {
            });
         }
      });
   </script>
</dom-module>

出力

アプリケーションを実行するには、作成されたプロジェクトディレクトリに移動し、次のコマンドを実行します。

polymer serve

ここでブラウザを開き、 http://127.0.0.1:8081/ に移動します。 出力は次のようになります。

ポリマーペーパーリップル