用 CSS 设置一个从头到尾速度相同的动画
使用 animation-timing-function 属性,带有 linear 值,从而用 CSS 设置从头到尾速度相同的动画
范例
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 150px;
height: 200px;
position: relative;
background-color: yellow;
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: linear;}
</style>
</head>
<body>
<div id = "demo">linear effect</div>
</body>
</html>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP