奔驰的小车

奔驰的小车

做了一个关于动画的小练习,挺好玩的,所以就分享给大家吧!!!代码很简单:

<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>练习</title>
    <style>
        body{
            background-color: lightblue; 
            overflow: hidden;

        }
        .ludiv{
            width: 100%;
            height: 200px;
            background-color: #7A7A7A;
            border-top: 10px solid brown;
            border-bottom: 10px solid brown;
            position: absolute;
            bottom: 0px;
            left: 0px;
            z-index: 100;
        }
        .xian{
            width: 100%;
            height: 10px;
            position: absolute;
            background-color: white;
            bottom: 100px;
            background-image: repeating-linear-gradient(to right,#D4D4D4 0%,#D4D4D4 10%,#7A7A7A 10%,#7A7A7A 20%)
        }
        .div1{
            width: 200px;
            height: 120px;
            background-color: transparent;
            position: absolute;
            top: -100px;

            animation: runn 10s infinite linear;
        }
        @keyframes runn{
            from{
                transform: translate(0%, 0%);
            }
            10%{
                transform: translate(10vw, 100%) rotateZ(0deg);
            }
            20%{
                transform: translate(20vw, 0%) rotateZ(0deg);
            }
            30%{
                transform: translate(30vw, 100%) rotateZ(0deg);
            }
            40%{
                transform: translate(40vw, 0%) rotateZ(0deg);
            }
            50%{
                transform: translate(50vw, 100%) rotateZ(0deg);
            }
            60%{
                transform: translate(60vw, 0%) rotateZ(0deg);
            }
            70%{
                transform: translate(70vw, 100%) rotateZ(0deg);
            }
            80%{
                transform: translate(80vw, 0%) rotateZ(0deg);
            }
            90%{
                transform: translate(90vw, 100%) rotateZ(0deg);
            }
            to{
                transform: translate(100vw, 0%);
            }
        }
        .img1{
            position: absolute;
            margin: 40px 15px;
        }
        .img2{
            position: absolute;
            top: 110px;
            left: 35px;
            animation: run 5s infinite linear;
        }
        .img3{
            position: absolute;
            top: 110px;
            left: 205px;
            animation: run 5s infinite linear;
        }
        @keyframes run{
            0%{transform: rotateZ(0deg);}
            100%{transform: rotateZ(3600deg);}
        }
        .taiyang{
            width: 300px;
            height: 300px;
            background-color: orange;
            border-radius: 0 0 0 300px;
            box-shadow: -3px 3px 15px red;
            position: absolute;
            right: 0px;
            top: 0px;    
        }
        .chaoyuan{
            width: 3000px;
            height: 3000px;
            background-color: green;
            border-radius:2000px 2000px 0 0; 
            position: absolute;

        }
        .chaoyuan1{
            top: 550px;
            left:-300px;
            opacity: 0.9;
        }
        .chaoyuan2{
            top: 500px;
            left:-1100px;
            opacity: 0.7;
        }
        .shan{
            width: 500px;
            height: 500px;
            background-color: pink;
            border-radius: 20px;
            transform: rotateZ(45deg);
            /*transform-origin: -230px 460px;*/
            top: 400px;
            position: absolute;
        }
    </style>
</head>
<body>
    <div class="chaoyuan chaoyuan1"></div>
    <div class="chaoyuan chaoyuan2"></div>
    <div class="shan"></div>
    <div class="taiyang"></div>
    <div class="ludiv">
        <div class="xian"></div>
        <div class="div1">
            <img src="http://a3.qpic.cn/psb?/V11qI0BQ26Ocim/oKaZzNQxA*R6qWnpGjLK0tBTtwS8c1vlj4.zxTOp6Cs!/b/dHwBAAAAAAAA&bo=EAF1AAAAAAADB0Y!&rf=viewer_4" alt="" class="img1">
            <img src="http://a1.qpic.cn/psb?/V11qI0BQ26Ocim/2mpO2HRQhB67Qk68bcrJiROC35762sXB0hDpr4NYFlI!/b/dHcBAAAAAAAA&bo=PAA8AAAAAAADByI!&rf=viewer_4" alt="" class="img2">
            <img src="http://a1.qpic.cn/psb?/V11qI0BQ26Ocim/2mpO2HRQhB67Qk68bcrJiROC35762sXB0hDpr4NYFlI!/b/dHcBAAAAAAAA&bo=PAA8AAAAAAADByI!&rf=viewer_4" alt="" class="img3">
        </div>
    </div>
</body>
</html>

效果如下:

奔驰的小车