使用 CSS 设置动画的结束有变慢效果
使用 animation-timing-function 属性,加 ease-out 值,就能用 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-out effect</div> </body> </html>
广告