简体   繁体   English

CSS动画计时问题

[英]css animation timing issue

My entire code looks like this: 我的整个代码如下:

.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;}
}

What is happening now is that the transition between image one and two is working create, except it takes too long so show the first image and it takes too long to go from the second image back to the first. 现在发生的是,正在创建图像1和图像2之间的过渡,除了它花费的时间太长,因此显示第一个图像并且从第二个图像返回到第一个图像花费的时间太长。

The opacity is what's being animated. 不透明性就是动画。 The % tells you what portion of the overall animation handles that part. %告诉您整个动画的哪一部分处理该部分。 So, from 0-45, you have an opacity of 1, then it fades from 45-90, and then it stays faded out from 90-100 and then snaps back to 1 again when the animation starts over. 因此,从0-45开始,您的不透明度为1,然后从45-90逐渐消失,然后从90-100逐渐消失,然后在动画重新开始时再次捕捉回1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM