html - css动画时间问题

标签 html css

我的整个代码如下所示:

.inner .css-img {
  max-width: 100%;
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0;
  -webkit-animation: css-carousel-fade 10s linear infinite;
  -moz-animation: css-carousel-fade 10s linear infinite;
  -ms-animation: css-carousel-fade 10s linear infinite;
  animation: css-carousel-fade 10s linear infinite;
}

.inner .css-img:nth-child(2) {
  -webkit-animation-delay: 5s;
  -moz-animation-delay: 5s;
  -ms-animation-delay: 5s;
  animation-delay: 5s;
}

@keyframes css-carousel-fade {
  0%, 50%, 100% { opacity: 0; }
  10%, 50% { opacity: 1;}
}

现在正在发生的事情是,第一张图片和第二张图片之间的过渡正在创建中,只是它花费的时间太长,因此显示第一张图片并且从第二张图片返回到第一张图片花费的时间太长。

最佳答案

不透明度是动画。 % 告诉您整个动画的哪一部分处理该部分。因此,从 0 到 45,不透明度为 1,然后从 45 到 90 逐渐淡出,然后从 90 到 100 保持淡出,然后在动画重新开始时再次恢复到 1。

关于html - css动画时间问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20575046/

相关文章:

html - CSS 定位以便中间层始终调整大小以垂直填充页面上可用的空白空间,从而没有滚动条?

javascript - HTML - 当我放大/缩小时我的内容变得困惑

html - 如何将元素放置在 flexbox 中,宽度相等?

css - :eq pseudo selector not working with Selenium WebDriver/Chrome

html - 理解css中的类

css - Bootstrap 菜单中的垂直对齐

html - 元素利润率最高的问题

html - 左 Div 应移至右 Div 下方

javascript - 如何在 html 5 canvas 中删除区域的剪辑

javascript - 使文本框中的默认值在使用 jQuery 输入文本之前不会更改