我有一个html div,它具有CSS过渡,可沿屏幕从左向右移动。我希望能够一一看到不同的帧,而不是1个不停的平滑动画。可能吗?
答案 0 :(得分:0)
尝试使用CSS <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" rel="stylesheet" />
<style>
.move {
display: inline-block;
padding: 20px;
color: white;
position: relative;
margin: 0 0 10px 0;
background: #757575;
}
.move-1 {
-webkit-animation: move-in-steps 8s steps(4) infinite;
animation: move-in-steps 8s steps(4) infinite;
}
.move-2 {
-webkit-animation: move-in-steps 8s infinite;
animation: move-in-steps 8s infinite;
}
body {
padding: 20px;
}
@-webkit-keyframes move-in-steps {
0% {
left: 0;
}
100% {
left: 100%;
}
}
@keyframes move-in-steps {
0% {
left: 0;
}
100% {
left: 100%;
}
}
</style>
</head>
<body>
<div class="move move-1">steps</div>
<br>
<div class="move move-2">no steps</div>
</body>
</html>
。希望对您有所帮助。
{{1}}