在css3动画中添加延迟时间

Jay*_*Lin 9 css css3 css-animations

我只是将动画设置为div并且成功了.现在我想证明它是因为它的延迟太短了!那么如何在动画(0%到25%)和动画(25%到50%)之间添加延迟时间这里是代码:

#flow{
      position:absolute;
      -webkit-animation:mymove 10s ease-in-out;
      -webkit-animation-iteration-count:3;
      -webkit-animation-delay:1s;
     }

@-webkit-keyframes mymove
    {
       0%{left:5px;}
       25%{left:127px;}
       50%{left:249px;}
       75%{left:371px;}
       100%{left:5px;}
     }
Run Code Online (Sandbox Code Playgroud)

大家好!感谢您的关注!我找到了答案,但我不知道关键帧中百分比定义的Api!如果您知道它,请给我一只手,非常感谢!

@-webkit-keyframes mymove
{
   0%{left:5px;} 
   25%{left:127px;}
   26%{left:127px;}
   27%{left:127px;}
   28%{left:127px;}
   29%{left:127px;}
   30%{left:127px;}
   31%{left:127px;}
   32%{left:127px;}
   33%{left:127px;}
   34%{left:127px;}
   35%{left:127px;} 
   50%{left:249px;}
   75%{left:371px;}
   100%{left:5px;}
 }
Run Code Online (Sandbox Code Playgroud)

gef*_*etz 9

我认为你不能延迟动画的单个部分.你可以做的是使用两个动画并延迟启动它们.

#flow{
      position:absolute;
      -webkit-animation:
          mymove_first 10s 0s 10 ease-in-out,
          mymove_second 10s 2s 10 ease-in-out;
     }

@-webkit-keyframes mymove_first
    {
       0%{left:5px;}
       25%{left:127px;}
     }

@-webkit-keyframes mymove_second
    {
       50%{left:249px;}
       75%{left:371px;}
       100%{left:5px;}
     }
Run Code Online (Sandbox Code Playgroud)