animation steps属性

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .hi{
            width: 50px;
            height: 72px;
            background-image: url("http://s.cdpn.io/79/sprite-steps.png");
            /*深度理解
            *整个动画1s完成。
            *这里1s要移动500的像素,这1s要有十步走完,每步是平均下来是0.1s,
            *每步比上一步多走了72px的位置,这个走是瞬间走到的。
            *end表示每一步在接近0.1s再去走
            */
            /* animation: play 1s steps(10,end) infinite; */
            animation: play 1s steps(10,start) infinite;

        }
        /*定义动画*/
        @keyframes play {
            from { background-position:    0px 0px; }
            to { background-position: -500px 0px; }
        }
    </style>
</head>
<body>
<img src="http://s.cdpn.io/79/sprite-steps.png" alt="此图片是500*72,主要是为了显示作用">
<div class="hi"></div>
 
</body>
</html>

参考:https://blog.csdn.net/LY_code/article/details/80209183?utm_source=blogxgwz0

animation-fill-mode : none | forwards | backwards | both;

none 不改变默认行为。 forwards 当动画完成后,保持最后一个属性值(在最后一个关键帧中定义)。 backwards 在 animation-delay 所指定的一段时间内,在动画显示之前,应用开始属性值(在第一个关键帧中定义)。 both 向前和向后填充模式都被应用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

web修理工

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值