CSS 参考手册
CSS3 transition-timing-function 属性
为了更好地理解不同的函数值:这里有五个不同的div元素,用5个不同的
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> div { width: 100px; height: 50px; background: red; color: white; font-weight: bold; transition: width 2s; -webkit-transition: width 2s; /* Safari */ } #div1 { transition-timing-function: linear; } #div2 { transition-timing-function: ease; } #div3 { transition-timing-function: ease-in; } #div4 { transition-timing-function: ease-out; } #div5 { transition-timing-function: ease-in-out; } /* Safari */ #div1 { -webkit-transition-timing-function: linear; } #div2 { -webkit-transition-timing-function: ease; } #div3 { -webkit-transition-timing-function: ease-in; } #div4 { -webkit-transition-timing-function: ease-out; } #div5 { -webkit-transition-timing-function: ease-in-out; } div:hover { width: 300px; } </style> </head> <body> <p><b>注意:</b> 该属性不兼容 IE 9 以及更早版本的浏览器</p> <div id="div1" style="top:100px">linear</div> <div id="div2" style="top:150px">ease</div> <div id="div3" style="top:200px">ease-in</div> <div id="div4" style="top:250px">ease-out</div> <div id="div5" style="top:300px">ease-in-out</div> <p>将鼠标移动至块上查看过渡动画效果.</p> </body> </html>
运行结果:
点击运行 »