Created
February 17, 2012 09:28
-
-
Save alexmwalker/1852133 to your computer and use it in GitHub Desktop.
CSS3 Pong *
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
/** | |
* CSS3 Pong * | |
*/ | |
body{ | |
background: #000; | |
} | |
#court { | |
margin-top:30px; | |
border:5px dashed #fff; | |
height:500px; | |
position:relative; | |
} | |
#horizontal { | |
width: auto; | |
height:40px; | |
padding-right:40px; | |
animation: vertical 1.7s infinite linear; | |
position:relative; | |
} | |
#vertical { | |
background:#0ff; | |
width: 40px; | |
height:40px; | |
border-radius:40px; | |
animation: horizontal 1.9s infinite linear; | |
} | |
#bat1, #bat2 { | |
background:#f00; | |
width: 10px; | |
height:60px; | |
margin-top:-10px; | |
position:absolute; | |
right:0px; | |
top:0px; | |
color:red | |
} | |
#bat2 { | |
left:0 | |
} | |
@keyframes vertical { /* flame pulses */ | |
0% { | |
top:0%; | |
margin-top:0px | |
} | |
50% { | |
top:100%; | |
margin-top:-40px | |
} | |
100% { | |
top:0%; | |
margin-top:0px | |
} | |
} | |
@keyframes horizontal { /* flame pulses */ | |
0% { | |
margin-left:0%; | |
} | |
50% { | |
margin-left:100%; | |
right:-40px | |
} | |
100% { | |
margin-left:0%; | |
} | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<div id="court"> | |
<div id="horizontal"> | |
<div id="vertical"> | |
</div> | |
<div id="bat1"></div> | |
<div id="bat2"></div> | |
</div> | |
</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
{"view":"split-vertical","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment