animation-timing-function: linear | ease | ease-in | ease-out | ease-in-out | cubic-bezier (n,n,n,n) | initial | inherit ;
Property Values
linear - specifies that the animation has the same speed from start to end.
ease - specifies that the animation starts slowly, then fast, then ends slowly. (The default value of this property is ease).
ease-in - specifies that the animation starts slowly.
ease-out - specifies that the animation ends slowly.
ease-in-out - specifies that the animation starts and ends slowly.
cubic-bezier (n,n,n,n) - allows specification of values in the cubic-bezier function. Possible values are numeric values from 0 to 1.
initial - specifies that the value of the property should be set to the default value.
inherit - specifies that the value of the property should be inherited from the parent element.
Example
This example shows the use of the animation-timing-function property.
<!DOCTYPE html> <html> <head> <title>CSS3 animation-timing-function</title> <style type="text/css"> div.animate { width:50px; height:50px; color:white; padding:2px; background:#312abc; position:relative; animation:boxmove 5s infinite; /* Firefox */ -moz-animation:boxmove 5s infinite; /* Safari and Google Chrome */ -webkit-animation:boxmove 5s infinite; } #test1 { animation-timing-function:linear; /* Firefox */ -moz-animation-timing-function:linear; /* Safari and Google Chrome */ -webkit-animation-timing-function:linear; } #test2 { animation-timing-function:ease; /* Firefox */ -moz-animation-timing-function:ease; /* Safari and Google Chrome */ -webkit-animation-timing-function:ease; } #test3 { animation-timing-function:ease-in; /* Firefox */ -moz-animation-timing-function:ease-in; /* Safari and Google Chrome */ -webkit-animation-timing-function:ease-in; } #test4 { animation-timing-function:ease-out; /* Firefox */ -moz-animation-timing-function:ease-out; /* Safari and Google Chrome */ -webkit-animation-timing-function:ease-out; } #test5 { animation-timing-function:ease-in-out; /* Firefox */ -moz-animation-timing-function:ease-in-out; /* Safari and Google Chrome */ -webkit-animation-timing-function:ease-in-out; } @keyframes boxmove { from {left:0px;} to {left:210px;} } @-moz-keyframes boxmove /* Firefox */ { from {left:0px;} to {left:210px;} } @-webkit-keyframes boxmove /* Safari and Google Chrome */ { from {left:0px;} to {left:210px;} } </style> </head> <body> <div id="test1" class="animate">linear</div> <br/> <div id="test2" class="animate">ease</div> <br/> <div id="test3" class="animate">ease-in</div> <br/> <div id="test4" class="animate">ease-out</div> <br/> <div id="test5" class="animate">ease-in-out</div> </body> </html>