css动画停留在最后一帧,在迭代计数的最后一帧停止CSS3动画(Stop a CSS3 Animation at the la...

你真的不能。 但是,如果你设置了动画对象,你希望他们在最后的状态,这是比较容易得到你要找的效果:

.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);

演示

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值