A Pen by Pan Stav Geffen on CodePen.
Created
March 19, 2016 22:14
-
-
Save anonymous/5925a523015041d2de76 to your computer and use it in GitHub Desktop.
Mouse Scroll Animation
This file contains 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
<div class="thing"> | |
<span class="mouse"> | |
<span class="mouse-movement"></span> | |
</span> | |
</div> |
This file contains 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
@-webkit-keyframes mouse-scroll | |
0% | |
top: 30% | |
opacity: 1 | |
15% | |
top: 50% | |
opacity: 1 | |
50% | |
top: 50% | |
opacity: 0 | |
100% | |
top: 30% | |
opacity: 0 | |
@keyframes mouse-scroll | |
0% | |
top: 30% | |
opacity: 1 | |
15% | |
top: 50% | |
opacity: 1 | |
50% | |
top: 50% | |
opacity: 0 | |
100% | |
top: 30% | |
opacity: 0 | |
body | |
background-color: white | |
.thing | |
width: 1em | |
height: 1em | |
margin: auto | |
padding: 2em | |
background-color: grey | |
.mouse | |
display: block | |
position: relative | |
width: 16px | |
height: 30px | |
margin: 0 auto 20px | |
border: 2px solid rgba(255,255,255,0.4) | |
border-radius: 16px | |
text-align: center | |
box-sizing: border-box | |
.mouse-movement | |
display: block | |
position: absolute | |
top: 30% | |
left: 50% | |
width: 4px | |
height: 8px | |
margin: -4px 0 0 -2px | |
border-radius: 4px | |
background: rgba(255,255,255,0.4) | |
-webkit-animation: mouse-scroll 4s linear infinite | |
animation: mouse-scroll 4s linear infinite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment