Created
November 26, 2017 20:50
-
-
Save kotarok/9126ef5d1b77d5d700ed4199a8fc3972 to your computer and use it in GitHub Desktop.
Material Design ripple effect Sass mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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