Skip to content

Instantly share code, notes, and snippets.

@kotarok
Created November 26, 2017 20:50
Show Gist options
  • Save kotarok/9126ef5d1b77d5d700ed4199a8fc3972 to your computer and use it in GitHub Desktop.
Save kotarok/9126ef5d1b77d5d700ed4199a8fc3972 to your computer and use it in GitHub Desktop.
Material Design ripple effect Sass mixin
@mixin ripple($color: rgba(#fff, .2)) {
position: relative;
overflow: hidden;
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 5px;
height: 5px;
background: $color;
opacity: 0;
border-radius: 100%;
transform: scale(1, 1) translate(-50%);
transform-origin: 50% 50%;
transition: .3s;
}
&:focus::after {
animation: ripple .7s ease-out;
}
}
@keyframes ripple {
0% {
transform: scale(0, 0);
opacity: 1;
}
20% {
transform: scale(25, 25);
opacity: 1;
}
100% {
opacity: 0;
transform: scale(40, 40);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment