• 页面加载动画_渐隐变色旋转小圆圈


    加载动画效果图示
    在这里插入图片描述

    源码

    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>
            * {
                margin: 0;
                padding: 0;
                /* 元素的总高度和宽度包含内边距和边框(padding 与 border) : */
                box-sizing: border-box;
            }
    
            section {
                /* 设置弹性盒模型 方便居中 */
                display: flex;
                justify-content: center;
                align-items: center;
                /* 最小高度百分百 */
                min-height: 100vh;
                background-color: #042104;
            }
    
            section .loader {
                position: relative;
                width: 120px;
                height: 120px;
            }
    
            section .loader span {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                /* background-color: aqua; */
                transform: rotate(calc(18deg*var(--i)));
                animation: animateBg 10s linear infinite;
            }
    
            @keyframes animateBg {
                0% {
                    /* filter滤镜 这里是设置色相旋转 */
                    filter: hue-rotate(0deg);
                }
    
                100% {
                    filter: hue-rotate(180deg);
                }
            }
    
            section .loader span::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                width: 15px;
                height: 15px;
                border-radius: 50%;
                background-color: #00ff0a;
                box-shadow: 0 0 10px #00ff0a, 0 0 20px #00ff0a, 0 0 40px #00ff0a, 0 0 60px #00ff0a, 0 0 80px #00ff0a, 0 0 100px #00ff0a;
                animation: animate 2s linear infinite;
                animation-delay: calc(0.1s*var(--i));
            }
    
            @keyframes animate {
                0% {
                    transform: scale(1)
                }
    
                80%,
                100% {
                    transform: scale(0);
                }
            }
        style>
    head>
    
    <body>
        <script>
            window.onload = e => {
                console.log(e);
                var body = document.getElementsByTagName('body')[0];
                var section = document.createElement('section')
                body.appendChild(section);
                var div = document.createElement('div');
                div.className = 'loader';
                section.appendChild(div);
                for (let index = 1; index <= 20; index++) {
                    let span = document.createElement('span');
                    span.style = '--i:' + index + ';';
                    div.appendChild(span)
                }
            }
        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
  • 相关阅读:
    Linux源码——启动流程1
    SD-WAN介绍
    通过顶顶通呼叫中心中间件玩转FreeSWITCH媒体流
    【Android】 屏幕录制screenrecord为什么这么快?
    【QT+QGIS跨平台编译】之五十三:【QGIS_CORE跨平台编译】—【qgssqlstatementparser.cpp生成】
    Android中的适配器,你知道是做什么的吗?
    搞了一个更完善的javaagent项目结构
    【PostgreSQL】查询30天前的数据
    抖音|快手抓包通杀插件
    Python学习之编写学生信息管理系统
  • 原文地址:https://blog.csdn.net/weixin_44368963/article/details/126152169