Giter VIP home page Giter VIP logo

paper-ripple's Introduction

paper-ripple

paper-ripple provides a visual effect that other paper elements can use to simulate a rippling effect emanating from the point of contact. The effect can be visualized as a concentric circle with motion.

Example:

<paper-ripple></paper-ripple>

paper-ripple listens to "mousedown" and "mouseup" events so it would display ripple effect when touches on it. You can also defeat the default behavior and manually route the down and up actions to the ripple element. Note that it is important if you call downAction() you will have to make sure to call upAction() so that paper-ripple would end the animation loop.

Example:

<paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple>
...
<script>
  downAction: function(e) {
    this.$.ripple.downAction({x: e.x, y: e.y});
  },
  upAction: function(e) {
    this.$.ripple.upAction();
  }
</script>

Styling ripple effect:

Use CSS color property to style the ripple:

paper-ripple {
  color: #4285f4;
}

Note that CSS color property is inherited so it is not required to set it on the paper-ripple element directly.

By default, the ripple is centered on the point of contact. Apply the recenters attribute to have the ripple grow toward the center of its container.

<paper-ripple recenters></paper-ripple>

Apply center to center the ripple inside its container from the start.

<paper-ripple center></paper-ripple>

Apply circle class to make the rippling effect within a circle.

<paper-ripple class="circle"></paper-ripple>

paper-ripple's People

Contributors

cdata avatar dfreedm avatar frankiefu avatar notwaldorf avatar addyosmani avatar jklein24 avatar danbeam avatar blasten avatar iiegor avatar sorvell avatar venuatu avatar adalinesimonian avatar tjsavage avatar samccone avatar progers avatar nhunzaker avatar kenmoore avatar jakemac53 avatar ebidel avatar tyriar avatar

Watchers

Henry Yip avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.