Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在CSS3中增加动画时间_Css - Fatal编程技术网

如何在CSS3中增加动画时间

如何在CSS3中增加动画时间,css,Css,我有一个带有css的div: #six { width: 100px; height: 100px; background: red; -webkit-animation: myfirst 5s infinite; -webkit-animation-delay: 2s; animation: myfirst 5s infinite; animation-delay: 2s; position: absolute; left: 100px; top: 210px; } /* Chrome, S

我有一个带有css的div:

#six {
width: 100px;
height: 100px;
background: red;
-webkit-animation: myfirst 5s infinite;
-webkit-animation-delay: 2s;
animation: myfirst 5s infinite;
animation-delay: 2s;
position: absolute;
left: 100px;
top: 210px;
}

/* Chrome, Safari, Opera */
@-webkit-keyframes myfirst {
    0%   {background: red;}
    25%  {background: yellow;}
    30%  {background: red;}
}


/* Standard syntax */
@keyframes myfirst {
    0%   {background: red;}
    25%  {background: yellow;}
    30%  {background: red;}
}
正如你所见,它只是使背景每五秒钟闪烁一次黄色。我怎么能让那五秒钟改变每一个循环?例如,第一次需要5秒,然后下一次需要4秒,然后是3、2、1等等


谢谢

您可以扩展您的动画来为您完成:

@keyframes myfirst {
    0% {background: red;}
    16.6666% {background: yellow;}
    33.3333% {background: red;}
    46.6666% {background: yellow;}
    60% {background: yellow;}
    70% {background: red;}
    80% {background: yellow;}
    86.6666% {background:red;}
    93.3333% {background:yellow;}
    96.6666% {background:red;}
    100% {backgrond:yellow};
}

据我所知,这里有一个

,您必须使用javascript/jquery来实现这一点。您可以扩展您的动画以支持它,因此您的总动画时间为15秒