Created
February 8, 2013 15:45
-
-
Save walterrenner/4739826 to your computer and use it in GitHub Desktop.
CSS3 Animation example
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Animation</title> | |
<style type="text/css"> | |
.background { | |
width: 100%; | |
height: 350px; | |
position: absolute; | |
left: 0; | |
top: 60px; | |
background: url(https://build.phonegap.com/images/marketing/cloud.jpg) repeat-x 50% 100%; | |
z-index: -5; | |
-webkit-animation: animate-cloud 15s linear infinite; | |
} | |
@-webkit-keyframes animate-cloud { | |
from { | |
background-position:1000px 100%; | |
} | |
to { | |
background-position:0 100%; | |
} | |
} | |
.wrapper { | |
width: 300px; | |
margin: auto; | |
} | |
#cube { | |
position: absolute; | |
top: 50px; | |
z-index: 1; | |
width: 300px; | |
height: 300px; | |
background-image: url(http://i49.tinypic.com/14mgdw.jpg); | |
background-size: 100%; | |
background-repeat: no-repeat; | |
-webkit-animation: shake 6s ease-in-out infinite; | |
} | |
@-webkit-keyframes shake { | |
25%, 75% { | |
-webkit-transform: translateY(-20px); | |
} | |
50% { | |
-webkit-transform: translateY(0); | |
} | |
} | |
#shadow { | |
position: absolute; | |
top: 230px; | |
z-index: 0; | |
width: 300px; | |
height: 200px; | |
background-image: url(http://i45.tinypic.com/9ibbso.png); | |
background-size: 100%; | |
background-repeat: no-repeat; | |
opacity:0.1; | |
-webkit-transform: scale(.9,.9); | |
-webkit-animation: sccale 6s ease-in-out infinite; | |
} | |
@-webkit-keyframes sccale { | |
25%, 75% { | |
-webkit-transform: scale(.8,.8); | |
opacity:0.1; | |
} | |
50% { | |
-webkit-transform: scale(.9, .9); | |
opacity:.3; | |
} | |
} | |
</style> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<div id="cube"></div> | |
<div id="shadow"></div> | |
</div> | |
<div class="background"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment