Css Can';不要在最后一帧停止动画
我试图播放一个角色跳跃动画,我想在最后一帧停止,但它没有停止。我试着用 动画填充模式:正向 没有结果 下面是我正在使用的代码Css Can';不要在最后一帧停止动画,css,animation,keyframe,Css,Animation,Keyframe,我试图播放一个角色跳跃动画,我想在最后一帧停止,但它没有停止。我试着用 动画填充模式:正向 没有结果 下面是我正在使用的代码 .kia-jump { width: 320px; height: 464px; position: absolute; top: 1%; left: 41%; background: url('../images/activity/KiaJumpingAnimation.png') left center; ani
.kia-jump {
width: 320px;
height: 464px;
position: absolute;
top: 1%;
left: 41%;
background: url('../images/activity/KiaJumpingAnimation.png') left center;
animation-fill-mode: forwards;
animation: jumpAnim 1.67s steps(24) 1;
}
@keyframes jumpAnim {
100% { background-position: -7920px; }
}
这里是指向JSFIDLE->的链接,实际上您还有一个额外的步骤,由于默认情况下您的
背景设置为repeat
,因此只需返回到最后的第一帧
.kia-jump {
width: 320px;
height: 464px;
position: absolute;
top: 1%;
left: 41%;
background: url('http://schoolcinema-sconline.rhcloud.com/images/activity/KiaJumpingAnimation.png') left center;
animation: jumpAnim 1.67s steps(23) 1 forwards;
}
@keyframes jumpAnim {
100% { background-position: -7590px; }
}
刚刚
7920-(7920/24)=7590
只需打开动画:jumpAnim 1.67s steps(24)1forwards@PaoloCargnin我想你是对的。动画是一种速记,所以之前的设置很有可能会被覆盖。@PaoloCargnin不起作用:(效果很好..你是摇滚明星;)谢谢你的帮助。。我累了,跟在“前锋”后面跑: