CSS 渐变动画

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box{
            width: 1000px;
            height: 100px;
            margin: 100px;
            background-image: linear-gradient(
            135deg,
            red 0%,
            black 25%,
            transparent 25%,
            transparent 50%,
            black 50%,
            black 75%,
            transparent 75%
            );
            background-size:100px 100px;
            background-repeat:repeat;
            animation: change 1s linear infinite ;
        }
        @keyframes change {
            0%{
                background-position: -100px 0;
            }
            100%{
                background-position: 0px 0;
            }
        }
    </style>
</head>
<body>
  <div class="box"></div>
</body>

效果如下:

原文地址:https://www.cnblogs.com/xzma/p/7597715.html