Testing some parallax scrolling with css animations. Images from wikipedia
Created
February 3, 2016 12:36
-
-
Save anonymous/8ebad89501bdd62b0921 to your computer and use it in GitHub Desktop.
Parallax Scroller
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
<div id="back"> | |
</div> | |
<div id="middle"> | |
</div> | |
<div id="front"> | |
</div> |
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
@-webkit-keyframes scroll { | |
from { | |
left: 0px; | |
} | |
50% { | |
left: -320px; | |
} | |
to { | |
left: -640px; | |
} | |
} | |
div { | |
position: fixed; | |
top: 0; | |
bottom: 0; | |
right: 0; | |
background-repeat: repeat-x; | |
} | |
div#back { | |
-webkit-animation: scroll 30s infinite linear; | |
background-image: url(https://upload.wikimedia.org/wikipedia/commons/9/9f/Sky_back_layer.png); | |
} | |
div#middle { | |
-webkit-animation: scroll 15s infinite linear; | |
background-image: url(https://upload.wikimedia.org/wikipedia/commons/8/8b/Vegetation_%28middle_layer%29.png); | |
} | |
div#front { | |
-webkit-animation: scroll 7s infinite linear; | |
background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Ground_%28front_layer%29.png); | |
} | |
body { | |
background: #BC9447; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment