<html>
<head>
<meta charset="utf-8" />
<title>Keyframe Animation Demo</title>
<style type="text/css">
/* Container properties */
#scene {
width: 400px;
height: 300px;
position: relative;
overflow: hidden;
/* Solid fallback for old browsers */
background: #0099ff;
/* Firefox */
background: linear-gradient(top, #0099ff, #00ccff);
/* WebKit - Chrome and Safari */
background: linear-gradient(top, #0099ff, #00ccff);
/* Internet Explorer 10 */
background: linear-gradient(top, #0099ff, #00ccff);
/* Opera */
background: linear-gradient(top, #0099ff, #00ccff);
/* general syntax */
background: linear-gradient(top, #0099ff, #00ccff);
}
/* Image Properties */
.blades {
/*image is 120 x 120 px*/
position: absolute;
top: 116px;
left: 196px;
/* Firefox */
animation: bladeSpin 10s ease-in-out infinite;
/* WebKit - Chrome and Safari */
animation: bladeSpin 10s ease-in-out infinite;
/* Opera */
animation: bladeSpin 10s ease-in-out infinite;
/* general syntax */
animation: bladeSpin 10s ease-in-out infinite;
}
.stand {
/*image is 12 x 130 px*/
position: absolute;
top: 170px;
left: 250px;
}
.cloud {
position: absolute;
/* Firefox */
animation: cloudDrift linear infinite;
/* WebKit - Chrome and Safari */
animation: cloudDrift linear infinite;
/* Opera */
animation: cloudDrift linear infinite;
/* general syntax */
animation: cloudDrift linear infinite;
}
.lrg {
/*width 130px*/
top: 40px;
left: -140px;
/* Firefox */
animation-duration: 40s;
/* WebKit - Chrome and Safari */
animation-duration: 40s;
/* Opera */
animation-duration: 40s;
/* general syntax */
animation-duration: 40s;
}
.sml {
/*width 70px*/
top: 10px;
left: -80px;
/* Firefox */
animation-duration: 20s;
/* WebKit - Chrome and Safari */
animation-duration: 20s;
/* Opera */
animation-duration: 20s;
/* general syntax */
animation-duration: 20s;
}
.med {
/*width 100px*/
top: 80px;
left: -110px;
/* Firefox */
animation-duration: 30s;
/* WebKit - Chrome and Safari */
animation-duration: 30s;
/* Opera */
animation-duration: 30s;
/* general syntax */
animation-duration: 30s;
}
/* Keyframe animations */
/* Blades Spinning */
/* Firefox */
@-moz-keyframes bladeSpin {
from { transform: rotate(0deg); }
to { transform: rotate(1440deg); }
}
/* WebKit - Chrome and Safari */
@-webkit-keyframes bladeSpin {
from { transform: rotate(0deg); }
to { transform: rotate(1440deg); }
}
/* Opera */
@-o-keyframes bladeSpin {
from { transform: rotate(0deg); }
to { transform: rotate(1440deg); }
}
/* general syntax */
@keyframes bladeSpin {
from { transform: rotate(0deg); }
to { transform: rotate(1440deg); }
}
/* Clouds drifting */
/* Firefox */
@-moz-keyframes cloudDrift {
from { transform: translateX(0px); }
to { transform: translateX(540px); }
}
/* WebKit - Chrome and Safari */
@-webkit-keyframes cloudDrift {
from { transform: translateX(0px); }
to { transform: translateX(540px); }
}
/* Opera */
@-o-keyframes cloudDrift {
from { transform: translateX(0px); }
to { transform: translateX(540px); }
}
/* general syntax */
@keyframes cloudDrift {
from { transform: translateX(0px); }
to { transform: translateX(540px); }
}
</style>
</head>
<body>
<div id="scene">
<img class="cloud sml" src="http://www.dwuser.com/education/content/creating-keyframe-animations-with-css3/images/cloud_sml.png" width="70" height="36"/>
<img class="cloud med" src="http://www.dwuser.com/education/content/creating-keyframe-animations-with-css3/images/cloud_med.png" width="100" height="52"/>
<img class="cloud lrg" src="http://www.dwuser.com/education/content/creating-keyframe-animations-with-css3/images/cloud_lrg.png" width="130" height="67"/>
<img class="blades" src="http://www.dwuser.com/education/content/creating-keyframe-animations-with-css3/images/blades.png" width="120" height="120"/>
<img class="stand" src="http://www.dwuser.com/education/content/creating-keyframe-animations-with-css3/images/stand.png" width="12" height="130"/>
</div>
</body>
</html>
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |