文字层叠动画效果

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文字层叠动画效果</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #f0f0f0;
            font-family: 'Arial', sans-serif;
            overflow: hidden;
        }

        .stack-container {
            position: relative;
            width: 300px;
            height: 200px;
        }

        .stack-text {
            position: absolute;
            font-size: 48px;
            font-weight: bold;
            color: #333;
            opacity: 0;
            transform: translateY(50px);
            animation: stackAnimation 3s infinite;
        }

        .stack-text:nth-child(1) {
            color: #ff6b6b;
            animation-delay: 0s;
        }

        .stack-text:nth-child(2) {
            color: #48dbfb;
            animation-delay: 0.5s;
        }

        .stack-text:nth-child(3) {
            color: #1dd1a1;
            animation-delay: 1s;
        }

        .stack-text:nth-child(4) {
            color: #feca57;
            animation-delay: 1.5s;
        }

        .stack-text:nth-child(5) {
            color: #5f27cd;
            animation-delay: 2s;
        }

        @keyframes stackAnimation {
            0% {
                opacity: 0;
                transform: translateY(50px);
            }
            20% {
                opacity: 1;
                transform: translateY(0);
            }
            80% {
                opacity: 1;
                transform: translateY(0);
            }
            100% {
                opacity: 0;
                transform: translateY(-50px);
            }
        }

        .credit {
            position: absolute;
            bottom: 20px;
            right: 20px;
            font-size: 12px;
            color: #999;
        }
    </style>
</head>
<body>
    <div class="stack-container">
        <div class="stack-text">层叠</div>
        <div class="stack-text">文字</div>
        <div class="stack-text">动画</div>
        <div class="stack-text">效果</div>
        <div class="stack-text">演示</div>
    </div>

    <script>
        // 可以在这里添加JavaScript代码来增强效果
        document.addEventListener('DOMContentLoaded', function() {
            console.log('文字层叠动画已加载 ');
        });
    </script>
</body>
</html>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值