OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --><!-- |
| 9 `paper-ripple` provides a visual effect that other paper elements can |
| 10 use to simulate a rippling effect emanating from the point of contact. The |
| 11 effect can be visualized as a concentric circle with motion. |
| 12 |
| 13 Example: |
| 14 |
| 15 <paper-ripple></paper-ripple> |
| 16 |
| 17 `paper-ripple` listens to "down" and "up" events so it would display ripple |
| 18 effect when touches on it. You can also defeat the default behavior and |
| 19 manually route the down and up actions to the ripple element. Note that it is |
| 20 important if you call downAction() you will have to make sure to call upAction() |
| 21 so that `paper-ripple` would end the animation loop. |
| 22 |
| 23 Example: |
| 24 |
| 25 <paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple> |
| 26 ... |
| 27 downAction: function(e) { |
| 28 this.$.ripple.downAction({x: e.x, y: e.y}); |
| 29 }, |
| 30 upAction: function(e) { |
| 31 this.$.ripple.upAction(); |
| 32 } |
| 33 |
| 34 Styling ripple effect: |
| 35 |
| 36 Use CSS color property to style the ripple: |
| 37 |
| 38 paper-ripple { |
| 39 color: #4285f4; |
| 40 } |
| 41 |
| 42 Note that CSS color property is inherited so it is not required to set it on |
| 43 the `paper-ripple` element directly. |
| 44 |
| 45 By default, the ripple is centered on the point of contact. Apply the `recenter
s` |
| 46 attribute to have the ripple grow toward the center of its container. |
| 47 |
| 48 <paper-ripple recenters></paper-ripple> |
| 49 |
| 50 Apply `circle` class to make the rippling effect within a circle. |
| 51 |
| 52 <paper-ripple class="circle"></paper-ripple> |
| 53 |
| 54 @group Paper Elements |
| 55 @element paper-ripple |
| 56 @homepage github.io |
| 57 --><!-- |
| 58 Fired when the animation finishes. This is useful if you want to wait until the
ripple |
| 59 animation finishes to perform some action. |
| 60 |
| 61 @event transitionend |
| 62 @param {Object} detail |
| 63 @param {Object} detail.node The animated node |
| 64 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 65 |
| 66 </head><body><dom-module id="paper-ripple"> |
| 67 <style> |
| 68 :host { |
| 69 display: block; |
| 70 position: absolute; |
| 71 border-radius: inherit; |
| 72 overflow: hidden; |
| 73 top: 0; |
| 74 left: 0; |
| 75 right: 0; |
| 76 bottom: 0; |
| 77 |
| 78 /* This resolves a rendering issue in Chrome 40 where the |
| 79 ripple is not properly clipped by its parent (which may have |
| 80 rounded corners. See: http://jsbin.com/temexa/4 */ |
| 81 -webkit-transform: translate3d(0, 0, 0); |
| 82 transform: translate3d(0, 0, 0); |
| 83 } |
| 84 |
| 85 :host([noink]) { |
| 86 pointer-events: none; |
| 87 } |
| 88 |
| 89 #background, |
| 90 #waves, |
| 91 .wave-container, |
| 92 .wave { |
| 93 pointer-events: none; |
| 94 position: absolute; |
| 95 top: 0; |
| 96 left: 0; |
| 97 width: 100%; |
| 98 height: 100%; |
| 99 } |
| 100 |
| 101 #background, |
| 102 .wave { |
| 103 opacity: 0; |
| 104 } |
| 105 |
| 106 #waves, |
| 107 .wave { |
| 108 overflow: hidden; |
| 109 } |
| 110 |
| 111 .wave-container, |
| 112 .wave { |
| 113 border-radius: 50%; |
| 114 } |
| 115 |
| 116 :host(.circle) #background, |
| 117 :host(.circle) #waves { |
| 118 border-radius: 50%; |
| 119 } |
| 120 |
| 121 :host(.circle) .wave-container { |
| 122 overflow: hidden; |
| 123 } |
| 124 |
| 125 </style> |
| 126 <template> |
| 127 <div id="background"></div> |
| 128 <div id="waves"></div> |
| 129 </template> |
| 130 </dom-module> |
| 131 <script src="paper-ripple-extracted.js"></script></body></html> |
OLD | NEW |