You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何消除CSS动画步骤间的停顿,实现圆形元素连贯运动?

解决动画停顿问题的方法

你的动画在70%到后续阶段出现停顿,核心原因是87%到95%的关键帧重复了相同状态,导致元素这段时间完全静止,再加上默认ease时序函数的速度衰减,放大了停顿感。要实现旋转结束后无停顿向上运动,按以下方式修改代码:

修改后的完整代码

:root {
  --final-rotation: calc(360deg * 5);
}

html {
  width: 100%;
  height: 100%;
}

body {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
}

.word {
  font-family: Arial, Helvetica, sans-serif;
  color: #52b87f;
  font-weight: 700;
  font-size: 70px;
  width: 100%;
  padding-left: 25%;
  padding-right: 25%;
  padding-bottom: 50px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.letter {
  position: relative;
  width: 150px;
  height: 150px;
  animation: bounce-o 2s;
  /* 可选:添加linear让移动匀速,彻底消除速度衰减带来的停顿感 */
  /* animation-timing-function: linear; */
}

@keyframes bounce-o {
  0% {
    scale: 0;
  }
  
  70% {
    scale: 2;
    transform: translateY(-85%) rotate(var(--final-rotation));
  }
  
  /* 移除87%的冗余帧,让旋转完成后直接过渡到最高位置 */
  95% {
    scale: 2;
    transform: translateY(-100%) rotate(var(--final-rotation));
  }
  
  100% {
    scale: 1;
    transform: translateY(0) rotate(var(--final-rotation));
  }
}
<div class="word">
<svg height="100" width="100" class="letter">
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
</div>

关键修改说明

  1. 删除冗余静止帧:去掉87%的重复状态关键帧,让元素在70%完成旋转后,直接从translateY(-85%)平滑过渡到translateY(-100%),彻底消除中间的静止停顿。
  2. 可选优化时序:如果希望移动过程完全匀速,给.letter加上animation-timing-function: linear;,避免默认ease带来的“慢快慢”速度变化,强化连续运动的视觉效果。

如果需要调整向上移动的速度,还可以修改95%这个关键帧的百分比(比如改成80%),让移动阶段的时间更短,运动更紧凑。

内容的提问来源于stack exchange,提问作者Ronny Efronny

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 10:25:23