发光文字加载特效与方向感应卡悬停效果

<!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;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #000;
            font-family: 'Arial', sans-serif;
            overflow: hidden;
            perspective: 1000px;
        }

        /* 发光文字加载特效 */
        .loading-text {
            position: relative;
            color: #fff;
            font-size: 4em;
            letter-spacing: 15px;
            text-transform: uppercase;
            width: 100%;
            text-align: center;
            -webkit-box-reflect: below 1px linear-gradient(transparent, #0008);
            line-height: 0.7em;
            outline: none;
            animation: animate 5s linear infinite;
        }

        @keyframes animate {
            0%, 18%, 20%, 50.1%, 60%, 65.1%, 80%, 90.1%, 92% {
                color: #0e3742;
                text-shadow: none;
            }
            18.1%, 20.1%, 30%, 50%, 60.1%, 65%, 80.1%, 90%, 92.1%, 100% {
                color: #fff;
                text-shadow: 0 0 10px #03bcf4,
                             0 0 20px #03bcf4,
                             0 0 40px #03bcf4,
                             0 0 80px #03bcf4,
                             0 0 160px #03bcf4;
            }
        }

        /* 方向感应卡效果 */
        .card-container {
            position: relative;
            width: 300px;
            height: 400px;
            margin: 50px;
            transform-style: preserve-3d;
            transition: transform 0.5s;
        }

        .card {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            border-radius: 15px;
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            transition: all 0.5s;
        }

        .card-front {
            background: linear-gradient(45deg, #ff00cc, #3333ff);
            transform: rotateY(0deg);
        }

        .card-back {
            background: linear-gradient(45deg, #3333ff, #ff00cc);
            transform: rotateY(180deg);
        }

        .card-content {
            color: white;
            text-align: center;
            padding: 20px;
        }

        .card-content h2 {
            margin-bottom: 20px;
            font-size: 24px;
        }

        .card-content p {
            font-size: 16px;
            line-height: 1.5;
        }

        .card-container:hover {
            transform: rotateY(180deg);
        }

        /* 3D悬停效果 */
        .card-3d {
            position: relative;
            width: 300px;
            height: 400px;
            margin: 50px;
            transform-style: preserve-3d;
            transition: transform 0.5s;
        }

        .card-3d:hover {
            transform: rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
        }

        .card-3d .card {
            transition: all 0.5s;
        }

        .card-3d .card:hover {
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
        }

        /* 网站链接样式 */
        .website-link {
            position: fixed;
            bottom: 20px;
            right: 20px;
            color: #03bcf4;
            text-decoration: none;
            font-size: 16px;
            z-index: 100;
            transition: all 0.3s;
        }

        .website-link:hover {
            text-shadow: 0 0 10px #03bcf4;
        }
    </style>
</head>
<body>
    <div class="loading-text">Loading...</div>

    <div class="card-container">
        <div class="card card-front">
            <div class="card-content">
                <h2>卡片正面</h2>
                <p>悬停查看背面效果</p>
            </div>
        </div>
        <div class="card card-back">
            <div class="card-content">
                <h2>卡片背面</h2>
                <p>这是一个简单的卡片翻转效果</p>
            </div>
        </div>
    </div>

    <div class="card-3d" id="card3d">
        <div class="card card-front">
            <div class="card-content">
                <h2>3D感应卡</h2>
                <p>移动鼠标查看3D效果</p>
            </div>
        </div>
    </div>

    <script>
        // 3D方向感应效果
        const card3d = document.getElementById('card3d');
        
        card3d.addEventListener('mousemove', (e) => {
            const xAxis = (window.innerWidth / 2 - e.pageX) / 25;
            const yAxis = (window.innerHeight / 2 - e.pageY) / 25;
            card3d.style.setProperty('--rotate-y', xAxis + 'deg');
            card3d.style.setProperty('--rotate-x', yAxis + 'deg');
        });

        card3d.addEventListener('mouseleave', () => {
            card3d.style.setProperty('--rotate-y', '0deg');
            card3d.style.setProperty('--rotate-x', '0deg');
        });

        // 发光文字动画
        const loadingText = document.querySelector('.loading-text');
        const text = "Loading...";
        let index = 0;

        function writeText() {
            loadingText.innerText = text.slice(0, index);
            index++;
            if (index > text.length) {
                index = 0;
            }
            setTimeout(writeText, 200);
        }

        writeText();
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值