使用 CSS 设置慢速开始和结束的动画
cssweb developmentfront end technology更新于 2024/7/19 17:16:17
使用 animation-timing-function 属性,并设置 ease-in-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-in-out effect</div>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

