纯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>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #ffebee;
            font-family: 'Arial', sans-serif;
            overflow: hidden;
        }
        
        .heart-container {
            position: relative;
            width: 100%;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        /* 心跳动画 */
        .heart {
            position: relative;
            width: 100px;
            height: 90px;
            animation: heartbeat 1.5s ease-in-out infinite;
            transform-origin: center;
        }
        
        .heart:before, .heart:after {
            content: "";
            position: absolute;
            top: 0;
            width: 50px;
            height: 80px;
            background: #ff4757;
            border-radius: 50px 50px 0 0;
        }
        
        .heart:before {
            left: 50px;
            transform: rotate(-45deg);
            transform-origin: 0 100%;
            box-shadow: -5px -5px 20px rgba(255, 71, 87, 0.5);
        }
        
        .heart:after {
            left: 0;
            transform: rotate(45deg);
            transform-origin: 100% 100%;
            box-shadow: 5px -5px 20px rgba(255, 71, 87, 0.5);
        }
        
        /* 心跳动画效果 */
        @keyframes heartbeat {
            0% {
                transform: scale(0.9);
            }
            5% {
                transform: scale(1);
            }
            10% {
                transform: scale(0.9);
            }
            15% {
                transform: scale(1.1);
            }
            50% {
                transform: scale(0.9);
            }
            100% {
                transform: scale(0.9);
            }
        }
        
        /* 心跳波纹效果 */
        .ripple {
            position: absolute;
            width: 100px;
            height: 100px;
            background: rgba(255, 71, 87, 0.2);
            border-radius: 50%;
            animation: ripple 2s ease-out infinite;
            opacity: 0;
        }
        
        .ripple:nth-child(2) {
            animation-delay: 0.5s;
        }
        
        .ripple:nth-child(3) {
            animation-delay: 1s;
        }
        
        @keyframes ripple {
            0% {
                transform: scale(0.5);
                opacity: 0.5;
            }
            100% {
                transform: scale(2.5);
                opacity: 0;
            }
        }
        
        /* 文字效果 */
        .text {
            position: absolute;
            bottom: 20%;
            color: #ff4757;
            font-size: 24px;
            font-weight: bold;
            text-align: center;
            text-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
            animation: textPulse 2s ease-in-out infinite;
        }
        
        @keyframes textPulse {
            0%, 100% {
                transform: scale(1);
                opacity: 0.8;
            }
            50% {
                transform: scale(1.05);
                opacity: 1;
            }
        }
        
        /* 引用链接 */
        .credit {
            position: absolute;
            bottom: 20px;
            color: #ff4757;
            font-size: 14px;
            opacity: 0.7;
        }
        
        .credit a {
            color: #ff4757;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="heart-container">
        <div class="heart"></div>
        <div class="ripple"></div>
        <div class="ripple"></div>
        <div class="ripple"></div>
        <div class="text">心跳的感觉</div>
    </div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值