css3幀動畫

原文鏈接:https://www.cnblogs.com/Fengzp/p/5548493.html

效果圖:
在這裏插入圖片描述

<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>css3逐幀動畫</title>
        <style>
        @keyframes run{
            0%{
                background-position: 0 0;
            }
            8.333%{
                background-position: -140px 0;
            }
            16.666%{
                background-position: -280px 0 ;
            }
            25.0%{
                background-position: -420px 0 ;
            }
            33.333%{
                background-position: -560px 0 ;
            }
            41.666%{
                background-position: -700px 0 ;
            }
            50.0%{
                background-position: -840px 0 ;
            }
            58.333%{
                background-position: -980px 0 ;
            }
            66.666%{
                background-position: -1120px 0 ;
            }
            75.0%{
                background-position: -1260px 0 ;
            }
            83.333%{
                background-position: -1400px 0 ;
            }
            91.666%{
                background-position: -1540px 0 ;
            }
            100%{
                background-position: 0 0 ;
            }
        }
        div{
            width:140px;
            height:140px;
            background: url(img/person.png);
            animation:run 1s steps(1, start) infinite;
            -webkit-animation:run 1s steps(1, start) infinite;
        }
        </style>
    </head>
    <body>
        <div></div>
    </body>
	</html>

圖片素材:
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章