Last active
January 20, 2018 03:29
-
-
Save jptksc/5f2ea6e19c94bc21becdad1e2ecbca19 to your computer and use it in GitHub Desktop.
Mouse Scrolling Animation
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
.mouse { | |
width: 26px; | |
height: 40px; | |
position: absolute; | |
bottom: 40px; | |
left: 50%; | |
transform: translate(-50%, 0); | |
z-index: 20; | |
border: 1px solid rgba(#ffffff, 0.5); | |
border-radius: 13px; | |
text-align: center; | |
font-size: 12px; | |
font-weight: 500; | |
line-height: 38px; | |
text-transform: uppercase; | |
letter-spacing: 1.5px; | |
color: rgba(#ffffff, 0.0); | |
&:after { | |
width: 100%; | |
height: 100%; | |
position: absolute; | |
top: -10px; | |
left: 0; | |
content: ''; | |
} | |
.text { | |
display: none; | |
} | |
.wheel { | |
width: 2px; | |
height: 5px; | |
position: absolute; | |
top: 0; | |
left: 50%; | |
background-color: rgba(#ffffff, 0.5); | |
border-radius: 2px; | |
// Add the default animation. | |
animation-name: down; | |
animation-duration: 2s; | |
animation-fill-mode: both; | |
animation-iteration-count: infinite; | |
} | |
&:hover { | |
width: auto; | |
height: 30px; | |
line-height: 28px; | |
padding: 0 15px; | |
border-radius: 20px; | |
border-color: rgba(#ffffff, 0.75); | |
color: rgba(#ffffff, 0.85); | |
&:after { | |
top: -20px; | |
} | |
.text { | |
display: block; | |
} | |
.wheel { | |
display: none; | |
} | |
} | |
} | |
@keyframes down { | |
0% { | |
transform: translate(-50%, 0); | |
opacity: 0; | |
} | |
50% { | |
opacity: 1; | |
} | |
100% { | |
transform: translate(-50%, 15px); | |
opacity: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment