HTML5+CSS3 吉普车动画

HTML5与CSS3实现吉普车动画

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML5+CSS3 吉普车动画</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            background: linear-gradient(to bottom, #87CEEB, #1E90FF);
            height: 100vh;
            overflow: hidden;
            position: relative;
            font-family: Arial, sans-serif;
        }
        
        .road {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 150px;
            background: #333;
        }
        
        .road::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            width: 100%;
            height: 6px;
            background: repeating-linear-gradient(
                to right,
                #fff,
                #fff 40px,
                transparent 40px,
                transparent 80px
            );
            animation: road-line 2s linear infinite;
        }
        
        .jeep {
            position: absolute;
            bottom: 150px;
            left: 50%;
            transform: translateX(-50%);
            width: 300px;
            height: 150px;
            animation: jeep-bounce 0.5s infinite alternate;
        }
        
        .jeep-body {
            position: absolute;
            width: 100%;
            height: 100%;
            background: #FF4500;
            border-radius: 20px 20px 0 0;
        }
        
        .jeep-top {
            position: absolute;
            top: 30px;
            left: 50%;
            transform: translateX(-50%);
            width: 180px;
            height: 80px;
            background: #FF4500;
            border-radius: 10px 10px 0 0;
        }
        
        .jeep-windshield {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: 160px;
            height: 40px;
            background: rgba(135, 206, 250, 0.7);
            border-radius: 5px;
        }
        
        .jeep-grille {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: 100px;
            height: 30px;
            background: #333;
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 2px;
            padding: 5px;
        }
        
        .jeep-grille-bar {
            background: #555;
        }
        
        .wheel {
            position: absolute;
            bottom: -25px;
            width: 60px;
            height: 60px;
            background: #333;
            border-radius: 50%;
            border: 8px solid #555;
            display: flex;
            justify-content: center;
            align-items: center;
            animation: wheel-rotate 0.5s linear infinite;
        }
        
        .wheel::before {
            content: '';
            width: 20px;
            height: 20px;
            background: #888;
            border-radius: 50%;
        }
        
        .wheel-front {
            left: 40px;
        }
        
        .wheel-back {
            right: 40px;
        }
        
        .wheel-spoke {
            position: absolute;
            width: 4px;
            height: 30px;
            background: #888;
            transform-origin: bottom center;
        }
        
        .mountain {
            position: absolute;
            bottom: 150px;
            width: 0;
            height: 0;
            border-left: 150px solid transparent;
            border-right: 150px solid transparent;
            border-bottom: 200px solid #2E8B57;
            animation: mountain-move 20s linear infinite;
        }
        
        .mountain:nth-child(2) {
            left: 200px;
            border-bottom-color: #228B22;
            animation-delay: -5s;
        }
        
        .mountain:nth-child(3) {
            left: 400px;
            border-bottom-color: #006400;
            animation-delay: -10s;
        }
        
        .cloud {
            position: absolute;
            background: white;
            border-radius: 50%;
            animation: cloud-move 30s linear infinite;
        }
        
        .cloud:nth-child(1) {
            top: 50px;
            left: 10%;
            width: 80px;
            height: 40px;
        }
        
        .cloud:nth-child(2) {
            top: 80px;
            left: 40%;
            width: 120px;
            height: 60px;
            animation-delay: -10s;
        }
        
        .cloud:nth-child(3) {
            top: 30px;
            left: 70%;
            width: 100px;
            height: 50px;
            animation-delay: -20s;
        }
        
        .sun {
            position: absolute;
            top: 50px;
            right: 100px;
            width: 80px;
            height: 80px;
            background: radial-gradient(circle, #FFD700, #FFA500);
            border-radius: 50%;
            box-shadow: 0 0 50px #FFA500;
        }
        
        .footer {
            position: absolute;
            bottom: 10px;
            width: 100%;
            text-align: center;
            color: white;
            text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
        }
        
        .footer a {
            color: #FFD700;
            text-decoration: none;
            transition: color 0.3s;
        }
        
        .footer a:hover {
            color: #FFA500;
            text-decoration: underline;
        }
        
        @keyframes jeep-bounce {
            0% {
                transform: translateX(-50%) translateY(0);
            }
            100% {
                transform: translateX(-50%) translateY(-10px);
            }
        }
        
        @keyframes wheel-rotate {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }
        
        @keyframes road-line {
            0% {
                transform: translateX(0);
            }
            100% {
                transform: translateX(-80px);
            }
        }
        
        @keyframes mountain-move {
            0% {
                transform: translateX(100vw);
            }
            100% {
                transform: translateX(-300px);
            }
        }
        
        @keyframes cloud-move {
            0% {
                transform: translateX(100vw);
            }
            100% {
                transform: translateX(-200px);
            }
        }
    </style>
</head>
<body>
    <div class="sun"></div>
    
    <div class="mountain"></div>
    <div class="mountain"></div>
    <div class="mountain"></div>
    
    <div class="cloud"></div>
    <div class="cloud"></div>
    <div class="cloud"></div>
    
    <div class="road"></div>
    
    <div class="jeep">
        <div class="jeep-body"></div>
        <div class="jeep-top"></div>
        <div class="jeep-windshield"></div>
        <div class="jeep-grille">
            <div class="jeep-grille-bar"></div>
            <div class="jeep-grille-bar"></div>
            <div class="jeep-grille-bar"></div>
            <div class="jeep-grille-bar"></div>
            <div class="jeep-grille-bar"></div>
        </div>
        <div class="wheel wheel-front">
            <div class="wheel-spoke" style="transform: rotate(0deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(72deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(144deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(216deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(288deg)"></div>
        </div>
        <div class="wheel wheel-back">
            <div class="wheel-spoke" style="transform: rotate(0deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(72deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(144deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(216deg)"></div>
            <div class="wheel-spoke" style="transform: rotate(288deg)"></div>
        </div>
    </div>
    
    <div class="footer">
        <p>HTML5+CSS3 吉普车动画</p>
    </div>
</body>
</html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值