css渐变实现进度条动画

<!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>
    <style>
        .box {
            position: relative;
            width: 600px;
            height: 60px;
            border-radius: 60px;
            overflow: hidden;
            box-sizing: border-box;
            background-color: #a9a9a9;
        }
        .box::after {
            content: "";
            position: absolute;
            width: 100%;
            height: 200%;
            top: 0;
            left: 0;
            background: repeating-linear-gradient(-45deg, yellow 0 20px, transparent 20px 40px);
            animation: move 0.5s linear infinite;
        }
        @keyframes move {
            from {
                transform: translateY(0);
            }
            to {
                transform: translateY(-58px);
            }
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

 

posted @ 2023-04-27 16:28  猫月贰  阅读(216)  评论(0)    收藏  举报