简体   繁体   English

加载CSS3动画的时间

[英]CSS3 animation timing on load

I currently have a css3 animation that rotates background images. 我目前有一个CSS3动画,可以旋转背景图像。 The issue is, i need the timing of the animations to be quite long, so they are not distracting and this is reflected with a black background on pageload until the 1st slide eases in. Here is what I have: 问题是,我需要动画的时间很长,因此它们不会分散注意力,这在页面加载时会以黑色背景反映出来,直到第一个幻灯片放宽为止。这是我的目的:

.cb-slideshow li span {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    color: transparent;
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: none;
    opacity: 0;
    z-index: 0;
    -webkit-backface-visibility: hidden;
    -webkit-animation: imageAnimation 144s linear infinite 0s;
    -moz-animation: imageAnimation 144s linear infinite 0s;
    -o-animation: imageAnimation 144s linear infinite 0s;
    -ms-animation: imageAnimation 144s linear infinite 0s;
    animation: imageAnimation 144s linear infinite 0s;
}
.cb-slideshow li:nth-child(1) span {
    background-image: url(../images/1.jpg)
}
.cb-slideshow li:nth-child(2) span {
    background-image: url(../images/2.jpg);
    -webkit-animation-delay: 24s;
    -moz-animation-delay: 24s;
    -o-animation-delay: 24s;
    -ms-animation-delay: 24s;
    animation-delay: 24;
}

What is the best way to adjust this so there is no black background in the beginning? 什么是最好的调整方式,以便一开始就没有黑色背景? Should I have a background default? 我应该有后台默认设置吗? Can I change the animation so that it eases the first slide in very quickly, but returns to normal for the following iterations? 我可以更改动画以使其非常快速地放宽第一张幻灯片,但在随后的迭代中恢复正常吗?

As I understand it, you have an animation than lasts 144 seconds. 据我了解,您的动画持续了144秒。

Then, you have several elements that share this animation, and where the second one is delayed 24 seconds. 然后,您有几个共享此动画的元素,第二个元素延迟了24秒。

So, I guess that you have 6 elements, and that the remaining ones are delayed at 48, 72, and so on. 因此,我想您有6个元素,其余的元素延迟为48、72,依此类推。

One way to make the first transition earlier is just to set the delays a little bit higher: 使第一个过渡更早的一种方法是将延迟设置得更高一些:

You have 0, 24, 48, 72, 96, 120. 您有0、24、48、72、96、120。

Set it to 1, 25, 49, 73, 97, 121. 将其设置为1,25,49,73,97,121。

The first transition will happen at 1 second. 第一次转换将在1秒后发生。

And, once started, everything keeps the same. 并且,一旦开始,一切都将保持不变。 (the delays between elements keep unchanged) (元素之间的延迟保持不变)

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

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