css实现奔跑的效果


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            width: 180px;
            height:300px;
            border:2px solid #ccc;
            left:45%;
            position: relative;

        }
    
        .d1 {
            width: 180px;
            height: 300px;
            position: absolute;
            background:url(./img/charector.png) 0 0 no-repeat;
            animation-name: move;
            animation-duration: 950ms;
            animation-iteration-count: infinite;
            /* step-start 马上跳转到动画每一帧结束的位置 */
            animation-timing-function: step-start;
        }

        @keyframes move {
            0% {
                background-position: 0 0;
            }
            14% {
                background-position: -180px 0;
            }

            28% {
                background-position: -360px 0;
            }
            42% {
                background-position: -540px 0;
            }

            56% {
                background-position: -720px 0;
            }
            70% {
                background-position: -900px 0;
            }
            84% {
                background-position: -1080px 0;
            }
            100% {
                background-position: 0 0;
            }
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="d1"></div>
    </div>
</body>
</html>

 

posted @   JackieDYH  阅读(7)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示