CSS3怪物表情动画特效

<!DOCTYPE html>
<html lang="zh-CN">
<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, #a8edea, #fed6e3);
            font-family: 'Arial', sans-serif;
            overflow: hidden;
        }

        .monster-container {
            position: relative;
            width: 300px;
            height: 300px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .monster-head {
            width: 200px;
            height: 200px;
            background: #7cffcb;
            border-radius: 50%;
            position: relative;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            animation: float 3s ease-in-out infinite;
        }

        .monster-eye {
            position: absolute;
            width: 50px;
            height: 70px;
            background: white;
            border-radius: 50%;
            top: 60px;
            overflow: hidden;
        }

        .monster-eye.left {
            left: 40px;
        }

        .monster-eye.right {
            right: 40px;
        }

        .monster-pupil {
            position: absolute;
            width: 25px;
            height: 25px;
            background: #333;
            border-radius: 50%;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            animation: blink 4s infinite, look 8s infinite;
        }

        .monster-mouth {
            position: absolute;
            width: 100px;
            height: 40px;
            background: #ff6b6b;
            border-radius: 0 0 50px 50px;
            bottom: 50px;
            left: 50%;
            transform: translateX(-50%);
            overflow: hidden;
            animation: mouth 5s infinite;
        }

        .monster-teeth {
            position: absolute;
            width: 100%;
            height: 15px;
            background: white;
            top: 0;
            display: flex;
            justify-content: space-around;
        }

        .monster-tooth {
            width: 15px;
            height: 15px;
            background: white;
            clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
        }

        .monster-horn {
            position: absolute;
            width: 30px;
            height: 50px;
            background: #7cffcb;
            top: -20px;
            clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
        }

        .monster-horn.left {
            left: 40px;
            transform: rotate(-30deg);
        }

        .monster-horn.right {
            right: 40px;
            transform: rotate(30deg);
        }

        .monster-blush {
            position: absolute;
            width: 30px;
            height: 15px;
            background: rgba(255, 107, 107, 0.4);
            border-radius: 50%;
            top: 100px;
            animation: blush 3s infinite;
        }

        .monster-blush.left {
            left: 20px;
        }

        .monster-blush.right {
            right: 20px;
        }

        /* 动画效果 */
        @keyframes float {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-20px);
            }
        }

        @keyframes blink {
            0%, 45%, 55%, 100% {
                height: 25px;
                bottom: 10px;
            }
            48%, 52% {
                height: 5px;
                bottom: 30px;
            }
        }

        @keyframes look {
            0%, 100% {
                transform: translateX(-50%);
            }
            25% {
                transform: translateX(-80%);
            }
            50% {
                transform: translateX(-50%);
            }
            75% {
                transform: translateX(-20%);
            }
        }

        @keyframes mouth {
            0%, 60%, 100% {
                height: 40px;
                border-radius: 0 0 50px 50px;
            }
            70%, 90% {
                height: 20px;
                border-radius: 0 0 25px 25px;
            }
        }

        @keyframes blush {
            0%, 100% {
                opacity: 0.4;
            }
            50% {
                opacity: 0.8;
            }
        }

        .title {
            position: absolute;
            bottom: 50px;
            left: 0;
            width: 100%;
            text-align: center;
            color: #333;
            font-size: 18px;
            font-weight: bold;
        }

        /* 插入的链接样式 */
        .inserted-link {
            position: absolute;
            top: 20px;
            right: 20px;
            color: #ff6b6b;
            text-decoration: none;
            font-size: 14px;
            padding: 8px 15px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.8);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            z-index: 100;
        }

        .inserted-link:hover {
            background: #ff6b6b;
            color: white;
            transform: translateY(-2px);
        }

        @media (max-width: 500px) {
            .monster-head {
                width: 150px;
                height: 150px;
            }
            
            .monster-eye {
                width: 40px;
                height: 50px;
                top: 40px;
            }
            
            .monster-pupil {
                width: 20px;
                height: 20px;
            }
            
            .monster-mouth {
                width: 80px;
                height: 30px;
                bottom: 40px;
            }
            
            .monster-horn {
                width: 25px;
                height: 40px;
            }
        }
    </style>
</head>
<body>
    <div class="monster-container">
        <div class="monster-head">
            <div class="monster-horn left"></div>
            <div class="monster-horn right"></div>
            
            <div class="monster-eye left">
                <div class="monster-pupil"></div>
            </div>
            
            <div class="monster-eye right">
                <div class="monster-pupil"></div>
            </div>
            
            <div class="monster-blush left"></div>
            <div class="monster-blush right"></div>
            
            <div class="monster-mouth">
                <div class="monster-teeth">
                    <div class="monster-tooth"></div>
                    <div class="monster-tooth"></div>
                    <div class="monster-tooth"></div>
                    <div class="monster-tooth"></div>
                </div>
            </div>
        </div>
        
        <h2 class="title">可爱的CSS3怪物表情</h2>
        
    </div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值