• 闪烁霓虹灯文字动画


    效果图
    在这里插入图片描述

    源码示例

    DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>闪烁霓虹灯文字动画title>
        <style>
            /* cyrillic */
            @font-face {
                font-family: 'Bad Script';
                font-style: normal;
                font-weight: 400;
                src: url(https://fonts.gstatic.com/s/badscript/v16/6NUT8F6PJgbFWQn47_x7pO8kzO1A.woff2) format('woff2');
                unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
            }
    
            /* latin */
            @font-face {
                font-family: 'Bad Script';
                font-style: normal;
                font-weight: 400;
                src: url(https://fonts.gstatic.com/s/badscript/v16/6NUT8F6PJgbFWQn47_x7pOskzA.woff2) format('woff2');
                unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
            }
    
            body {
                margin: 0;
                padding: 0;
                display: flex;
                justify-content: center;
                align-items: center;
                height: 100vh;
                background-color: #000;
                font-family: 'Bad Script', cursive;
            }
    
            h1 {
                margin: 0;
                padding: 0;
                color: #111;
                font-size: 16em;
            }
    
            h1 span {
                display: table-cell;
                margin: 0;
                padding: 0;
                animation: animate 2s linear infinite;
                animation-delay: calc(var(--i)*0.25s);
            }
    
            @keyframes animate {
    
                0%,
                100% {
                    color: #fff;
                    filter: blur(2px);
                    text-shadow: 0 0 10px #00b3ff,
                        0 0 10px #00b3ff,
                        0 0 20px #00b3ff,
                        0 0 40px #00b3ff,
                        0 0 80px #00b3ff,
                        0 0 120px #00b3ff,
                        0 0 200px #00b3ff,
                        0 0 300px #00b3ff,
                        0 0 400px #00b3ff;
                }
    
                5%,
                95% {
                    color: #111;
                    filter: blur(0px);
                    text-shadow: none;
                }
            }
        style>
    head>
    
    <body>
        <h1 class="text-luminous">
        h1>
        <Script>
            window.onload = () => {
                let strText = "stunning"
                strLuminous(strText);
                function strLuminous() {
                    let luminousBox = document.getElementsByClassName("text-luminous")[0];
                    var strList = arguments[0].slice("");
                    for (let index = 0; index < strList.length; index++) {
                        var span = document.createElement('span');
                        span.style = '--i:' + index + ';';
                        span.innerHTML = strList[index];
                        luminousBox.appendChild(span);
                        luminousBox.style = 'background-color: #000;'
                    }
                }
            };
        Script>
    body>
    
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
  • 相关阅读:
    面试必知的9个性能测试指标,你完全了解吗?
    3个变化3秒区别MT4和MT5
    Mysql主从复制
    SANs证书是什么?
    node深度打印对象
    Windows与网络基础-18-注册表基础
    Prometheus监控docker容器
    c# 扩展类,扩展方法
    吃透这份高并发/调优/分布式等350道面试宝典,已涨30k
    c++四种强制类型转换
  • 原文地址:https://blog.csdn.net/weixin_44368963/article/details/126169334