在迭代计数的最后一帧停止CSS3动画

在迭代计数的最后一帧停止CSS3动画,css,animation,sass,Css,Animation,Sass,我已经用一个派定时器在一个点上设置了一支笔 但是,在这个特定示例中,我还没有弄清楚如何在迭代计数0.9的最后一帧停止动画 添加以下CSS属性: -webkit-animation-fill-mode: forwards; 不会修复它。你真的不能。但是,如果将动画对象设置为希望它们最终进入的状态,则相对容易获得所需的效果: .wrapper { position: relative; margin: 40px auto; background: #d5d5d5; border-r

我已经用一个派定时器在一个点上设置了一支笔

但是,在这个特定示例中,我还没有弄清楚如何在迭代计数0.9的最后一帧停止动画

添加以下CSS属性:

-webkit-animation-fill-mode: forwards;

不会修复它。

你真的不能。但是,如果将动画对象设置为希望它们最终进入的状态,则相对容易获得所需的效果:

.wrapper {
  position: relative;
  margin: 40px auto;
  background: #d5d5d5;
  border-radius: 50%;
}

@mixin timer($item, $duration, $size, $color, $end, $hover: pause) {
  #{$item}, #{$item} * { @include box-sizing(border-box); }

  #{$item} { 
    width: $size;
    height: $size;
  }

  #{$item} .pie {
    width: 50%;
    height: 100%;
    transform-origin: 100% 50%;
    position: absolute;
    background: $color;
  }

  #{$item} .spinner {
    border-radius: 100% 0 0 100% / 50% 0 0 50%;
    z-index: 200;
    transform: rotate(360deg*.9);
    animation: rota $duration + s linear $end;
  }

  #{$item}:hover .spinner,
  #{$item}:hover .filler, 
  #{$item}:hover .mask {
    animation-play-state: $hover;
  }

  #{$item} .filler {
    border-radius: 0 100% 100% 0 / 0 50% 50% 0; 
    left: 50%;
    opacity: 1;
    z-index: 100;
    animation: opa $duration + s steps(1,end) $end reverse;
  }

  #{$item} .mask {
    border-radius: 100% 0 0 100% / 50% 0 0 50%;
    width: 50%;
    height: 100%;
    position: absolute;
    background: inherit;
    z-index: 300;
    opacity: 0;
    animation: opa $duration + s steps(1,end) $end;
  }

  @keyframes rota {
    0% { transform: rotate(0deg); }
    90% { transform: rotate(360deg*.9); }
  }

  @keyframes opa {
    0% { opacity: 1; }
    50%, 100% { opacity: 0; }
  }
}

@include timer('.wrapper', 5, 250px, #6c6, 0.9);

很遗憾,它不适用于其他值,请尝试将值.9替换为.3,将90%替换为30%。请单击此处。与30%的人一起工作:。你不需要。填充或opa,如果因为你的设置低于50%。