gpt4 book ai didi

css - 可以逐帧查看css过渡吗?

转载 作者:行者123 更新时间:2023-11-28 01:25:20 26 4
gpt4 key购买 nike

我有一个 html div,带有 css transition,它沿着屏幕从左到右移动。我希望能够一帧一帧地看到不同的帧,而不是 1 个不停的流畅动画。这可能吗?

最佳答案

尝试使用 CSS steps()。希望对您有所帮助。

<!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>

关于css - 可以逐帧查看css过渡吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51278497/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com