
css 动画:实现突变效果
在 CSS 动画中实现突变效果,即在动画过程中跳过某一段距离,有以下几种方法:
示例:
假设有两个箭头,需要从左到右移动,箭头 B 需要先从 30% 移动到 100%,再从 0 开始移动到 30%。
使用负数延时:
立即学习“前端免费学习笔记(深入)”;
<div class="arrow a"></div> <div class="arrow b"></div>
@keyframes move1 {
0% {
left: 0;
}
100% {
left: 100px;
}
}
.arrow {
animation: 10s linear move1;
}
.b {
animation-delay: -3s;
}使用多个动画:
<div class="arrow a"></div> <div class="arrow b"></div>
@keyframes move1 {
0% {
left: 0;
}
30% {
left: 30px;
}
}
@keyframes move2 {
0% {
left: 30px;
}
100% {
left: 100px;
}
}
.arrow {
animation: 10s linear move1;
}
.b {
animation: 5s linear move2;
animation-delay: 3s;
}以上就是如何在 CSS 动画中实现突变效果?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号