其他分享
首页 > 其他分享> > Css动画-呼吸点效果

Css动画-呼吸点效果

作者:互联网

图片地址:https://a.amap.com/Loca/static/loca-v2/demos/images/breath_red.png

图片

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="breathingPoint"></div>
</body>
<style>
    #breathingPoint {
        /* 系列图片每张间隙 图片总宽度÷数量 */
        width: 120px;
        /* 图片宽度 */
        height: 120px;
        /* 图片地址 */
        background: url(https://a.amap.com/Loca/static/loca-v2/demos/images/breath_red.png) no-repeat;
        /* 动画名称 */
        animation: run 1s steps(1) infinite;
        -webkit-animation: run 1s steps(1) infinite;
    }
    /* 动画 */
    @keyframes run {

        0%,
        100% {
            background-position: 0 0;
        }

        5% {
            background-position: -120px 0;
        }

        10% {
            background-position: -240px 0;
        }

        15% {
            background-position: -360px 0;
        }

        20% {
            background-position: -480px 0;
        }

        25% {
            background-position: -600px 0;
        }

        30% {
            background-position: -720px 0;
        }

        35% {
            background-position: -840px 0;
        }

        40% {
            background-position: -960px 0;
        }

        45% {
            background-position: -1080px 0;
        }

        50% {
            background-position: -1200px 0;
        }

        55% {
            background-position: -1320px 0;
        }

        60% {
            background-position: -1440px 0;
        }

        65% {
            background-position: -1560px 0;
        }

        70% {
            background-position: -1680px 0;
        }

        75% {
            background-position: -1800px 0;
        }

        80% {
            background-position: -1920px 0;
        }

        85% {
            background-position: -2040px 0;
        }

        90% {
            background-position: -2160px 0;
        }

        95% {
            background-position: -2280px 0;
        }
    }
</style>

</html>

标签:动画,run,120px,呼吸,background,position,Css,图片
来源: https://blog.csdn.net/qq_41646298/article/details/120778233