使用 CSS 设置缓慢开始和结束的动画
使用具有 缓入缓出 值的动画时间功能属性,使用 CSS 设置动画,使其缓慢开始并结束
实例
<!DOCTYPE html> <html> <head> <style> div { width: 150px; height: 200px; position: relative; background-color: #808000; animation-name: myanim; animation-duration: 2s; animation-direction: alternate-reverse; animation-iteration-count: 3; } @keyframes myanim { from {left: 100px;} to {left: 200px;} } #demo {animation-timing-function: ease-out;} </style> </head> <body> <div id = "demo">ease-in-out effect</div> </body> </html>
广告