gpt4 book ai didi

CSS3 动画 : transition speed between animations too slow

转载 作者:太空宇宙 更新时间:2023-11-04 14:44:55 25 4
gpt4 key购买 nike

我用以下动画构建了一个 slider 。不幸的是,幻灯片之间的过渡持续时间太长。我还没有找到合适的属性来设置切换幻灯片之间的速度。

/* Keyframes */

@-webkit-keyframes animation_slides {
0%
{
opacity:0;
}
6%
{
opacity:1;
}
24%
{
opacity:1;
}
30%
{
opacity:0;
}
100%
{
opacity:0;
}
}

/* Animations on my ul li elements */

-webkit-animation-name: animation_slides;
-webkit-animation-duration: 30.0s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: normal;
-webkit-animation-delay: 0;
-webkit-animation-play-state: running;
-webkit-animation-fill-mode: forwards;

&:nth-child(2)
{
-webkit-animation-delay: 6.0s;
-moz-animation-delay: 6.0s;
}

&:nth-child(3)
{
-webkit-animation-delay: 12.0s;
-moz-animation-delay: 12.0s;
}

&:nth-child(4)
{
-webkit-animation-delay: 18.0s;
-moz-animation-delay: 18.0s;
}

&:nth-child(5)
{
-webkit-animation-delay: 24.0s;
-moz-animation-delay: 24.0s;
}

你能帮帮我吗?非常感谢您!

最佳答案

每个说值没有“速度”,但有“持续时间”和“延迟”。看起来您可以将 -webkit-animation-duration: 30.0s; 的值更改为任何您想要的值,并相应地更改所有 nth-child -webkit -animation-delay-moz-animation-delay同比例影响转场的‘速度’

例如,这将使过渡时间减半:

/* Animations on my ul li elements */

-webkit-animation-name: animation_slides;
-webkit-animation-duration: 15.0s; /* A value I changed */
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: normal;
-webkit-animation-delay: 0;
-webkit-animation-play-state: running;
-webkit-animation-fill-mode: forwards;

&:nth-child(2)
{
-webkit-animation-delay: 3.0s; /* A value I changed */
-moz-animation-delay: 3.0s; /* A value I changed */
}

&:nth-child(3)
{
-webkit-animation-delay: 6.0s; /* A value I changed */
-moz-animation-delay: 6.0s; /* A value I changed */
}

&:nth-child(4)
{
-webkit-animation-delay: 9.0s; /* A value I changed */
-moz-animation-delay: 9.0s; /* A value I changed */
}

&:nth-child(5)
{
-webkit-animation-delay: 12.0s; /* A value I changed */
-moz-animation-delay: 12.0s; /* A value I changed */
}

只要总时长和第 n 个 child 延迟之间的比例保持不变,它就会相应地改变速度

关于CSS3 动画 : transition speed between animations too slow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17953171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com