CSS3 keyframe animation timing functions
by ian_smithz
HTML
<div id="div1">linear</div>
<div id="div2">ease</div>
<div id="div3">ease-in</div>
<div id="div4">ease-out</div>
<div id="div5">ease-in-out</div>
CSS
html, body {
margin: 0;
padding: 0;
}
@-webkit-keyframes width {
0%, 100% {
width: 160px;
}
50% {
width: 400px;
}
}
@-moz-keyframes width {
0%, 100% {
width: 160px;
}
50% {
width: 400px;
}
}
@-o-keyframes width {
0%, 100% {
width: 160px;
}
50% {
width: 400px;
}
}
div {
width:160px;
height:40px;
padding-left: 20px;
margin: 10px 0;
color:white;
font: 18px Georgia;
line-height: 40px;
vertical-align: middle;
background:#05f;
-webkit-animation: width 5s infinite;
-moz-animation: width 5s infinite;
-o-animation: width 5s infinite;
}
#div1 {animation-timing-function: linear;}
#div2 {animation-timing-function: ease;}
#div3 {animation-timing-function: ease-in;}
#div4 {animation-timing-function: ease-out;}
#div5 {animation-timing-function: ease-in-out;}
/* Firefox 4: */
#div1 {-moz-animation-timing-function: linear;}
#div2 {-moz-animation-timing-function: ease;}
#div3 {-moz-animation-timing-function: ease-in;}
#div4 {-moz-animation-timing-function: ease-out;}
#div5 {-moz-animation-timing-function: ease-in-out;}
/* Safari and Chrome: */
#div1 {-webkit-animation-timing-function: linear;}
#div2 {-webkit-animation-timing-function: ease;}
#div3 {-webkit-animation-timing-function: ease-in;}
#div4 {-webkit-animation-timing-function: ease-out;}
#div5 {-webkit-animation-timing-function: ease-in-out;}
/* Opera: */
#div1 {-o-transition-animation-function: linear;}
#div2 {-o-transition-animation-function: ease;}
#div3 {-o-transition-animation-function: ease-in;}
#div4 {-o-transition-animation-function: ease-out;}
#div5 {-o-transition-animation-function: ease-in-out;}