纯CSS3卡通水果拳击手特效

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>纯CSS3卡通水果拳击手特效</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, #ff9a9e, #fad0c4);
            overflow: hidden;
            font-family: Arial, sans-serif;
        }
        
        .ring {
            position: relative;
            width: 400px;
            height: 400px;
            border: 15px solid #8b4513;
            border-radius: 50%;
            box-shadow: 0 0 30px rgba(0,0,0,0.3);
            background: #f0f0f0;
            overflow: hidden;
        }
        
        .boxer {
            position: absolute;
            width: 120px;
            height: 150px;
            bottom: 50px;
            animation: bounce 0.8s ease-in-out infinite alternate;
        }
        
        .boxer.left {
            left: 80px;
        }
        
        .boxer.right {
            right: 80px;
            transform: scaleX(-1);
        }
        
        .fruit-body {
            position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            top: 0;
            left: 10px;
        }
        
        .strawberry .fruit-body {
            background: #ff4d6d;
            box-shadow: inset -10px -10px 30px rgba(0,0,0,0.2);
        }
        
        .orange .fruit-body {
            background: #ff9e00;
            box-shadow: inset -10px -10px 30px rgba(0,0,0,0.2);
        }
        
        .leaf {
            position: absolute;
            width: 30px;
            height: 30px;
            background: #4caf50;
            border-radius: 50% 50% 0 50%;
            top: -5px;
            left: 35px;
            transform: rotate(-45deg);
        }
        
        .eye {
            position: absolute;
            width: 20px;
            height: 25px;
            background: white;
            border-radius: 50%;
            top: 30px;
        }
        
        .eye.left {
            left: 25px;
        }
        
        .eye.right {
            right: 25px;
        }
        
        .pupil {
            position: absolute;
            width: 10px;
            height: 10px;
            background: #333;
            border-radius: 50%;
            top: 7px;
            left: 5px;
        }
        
        .mouth {
            position: absolute;
            width: 30px;
            height: 15px;
            border-bottom: 3px solid #333;
            border-radius: 0 0 50% 50%;
            top: 60px;
            left: 35px;
        }
        
        .arm {
            position: absolute;
            width: 60px;
            height: 20px;
            background: #4caf50;
            border-radius: 10px;
            bottom: 40px;
            transform-origin: left center;
            animation: punch 1s ease-in-out infinite alternate;
        }
        
        .arm.left {
            left: -30px;
            animation-delay: 0.4s;
        }
        
        .arm.right {
            right: -30px;
        }
        
        .glove {
            position: absolute;
            width: 30px;
            height: 30px;
            background: #ff0000;
            border-radius: 50%;
            box-shadow: inset -5px -5px 10px rgba(0,0,0,0.2);
        }
        
        .glove.left {
            left: -15px;
            top: -5px;
        }
        
        .glove.right {
            right: -15px;
            top: -5px;
        }
        
        .seed {
            position: absolute;
            width: 5px;
            height: 5px;
            background: rgba(255,255,255,0.7);
            border-radius: 50%;
        }
        
        .title {
            position: absolute;
            top: 30px;
            color: #d32f2f;
            font-size: 36px;
            text-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        
        .link {
            position: absolute;
            bottom: 20px;
            right: 20px;
            color: #d32f2f;
            font-size: 14px;
            text-decoration: none;
            font-weight: bold;
        }
        
        @keyframes bounce {
            0% { transform: translateY(0); }
            100% { transform: translateY(-20px); }
        }
        
        @keyframes punch {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(-30deg); }
        }
        
        .audience {
            position: absolute;
            width: 100%;
            height: 100px;
            bottom: 0;
            display: flex;
            justify-content: center;
            gap: 20px;
        }
        
        .fan {
            width: 40px;
            height: 40px;
            background: #ff9800;
            border-radius: 50%;
            position: relative;
            animation: cheer 1s ease-in-out infinite alternate;
        }
        
        .fan::before {
            content: '👏';
            position: absolute;
            font-size: 20px;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
        }
        
        @keyframes cheer {
            0% { transform: translateY(0); }
            100% { transform: translateY(-10px); }
        }
    </style>
</head>
<body>
    <h1 class="title">水果拳击大赛</h1>
    
    <div class="ring">
        <div class="boxer left strawberry">
            <div class="fruit-body">
                <!-- 草莓籽将通过JS添加 -->
            </div>
            <div class="leaf"></div>
            <div class="eye left"><div class="pupil"></div></div>
            <div class="eye right"><div class="pupil"></div></div>
            <div class="mouth"></div>
            <div class="arm left"><div class="glove left"></div></div>
            <div class="arm right"><div class="glove right"></div></div>
        </div>
        
        <div class="boxer right orange">
            <div class="fruit-body"></div>
            <div class="leaf"></div>
            <div class="eye left"><div class="pupil"></div></div>
            <div class="eye right"><div class="pupil"></div></div>
            <div class="mouth"></div>
            <div class="arm left"><div class="glove left"></div></div>
            <div class="arm right"><div class="glove right"></div></div>
        </div>
    </div>
    
    <div class="audience">
        <div class="fan" style="animation-delay: 0s;"></div>
        <div class="fan" style="animation-delay: 0.2s;"></div>
        <div class="fan" style="animation-delay: 0.4s;"></div>
        <div class="fan" style="animation-delay: 0.6s;"></div>
        <div class="fan" style="animation-delay: 0.8s;"></div>
    </div>
    

    <script>
        // 添加草莓籽
        const strawberryBody = document.querySelector('.strawberry .fruit-body');
        for (let i = 0; i < 20; i++) {
            const seed = document.createElement('div');
            seed.className = 'seed';
            
            // 随机位置
            const angle = Math.random() * Math.PI * 2;
            const radius = Math.random() * 30 + 10;
            seed.style.left = `calc(50% + ${Math.cos(angle) * radius}px`;
            seed.style.top = `calc(50% + ${Math.sin(angle) * radius}px`;
            
            // 随机大小
            const size = 2 + Math.random() * 3;
            seed.style.width = `${size}px`;
            seed.style.height = `${size}px`;
            
            strawberryBody.appendChild(seed);
        }
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值