zoukankan      html  css  js  c++  java
  • css3实现雷达图

    效果图:

    gif图:



    代码:

    <!DOCTYPE html>
    <html >
    <head>
    <meta charset="UTF-8">   
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>   
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />       
    <title>Radar</title>
    <style type="text/css">
    html {height: 100%;}
    body { 100%;height: 100%;position: relative;padding: 0;margin: 0;}
    .m-wrapper {position: relative;left: 50%;top: 50%; 600px;height: 600px;-webkit-transform: translate(-50%, -50%);transform: translate(-50%, -50%);border-radius: 50%;border: 1px solid #dddddd;overflow: hidden;text-align: center;}
    .m-center{display: inline-block;position: absolute;margin: auto;top: 0; bottom: 0;left: 0;right: 0;}
    .m-divison1{ 400px;height: 400px;border: 1px solid #dddddd;border-radius: 50%;}
    .m-divison2{ 200px;height: 200px;border: 1px solid #dddddd;border-radius: 50%;background-color: #ffffff;z-index: 9;}
    .m-circle { 180px; height: 180px;border-radius: 90px;overflow: hidden;}
    .m-circle-loading {position: absolute;top: 0;left:0; 50%; height: 100%;
        background: -webkit-linear-gradient(bottom, rgba(255, 255, 255, 0), #6699ff);
        background: -moz-linear-gradient(top, rgba(255, 255, 255, 0), #6699ff);   
        background: linear-gradient(to top, rgba(255, 255, 255, 0), #6699ff);
        -webkit-animation: radar-beam 5s infinite;
        animation: radar-beam 5s infinite;
        -webkit-animation-timing-function: linear;
        animation-timing-function: linear;
        -webkit-transform-origin: center right;
        transform-origin: center right;border-top-left-radius: 90px;border-bottom-left-radius:90px;}
    .m-circle-loading-radius{position: absolute;top: 0;right: 0; 10px;height: 10px;background: #6699ff;border-top-right-radius: 50%;border-bottom-right-radius: 50%;-webkit-transform: translateX(5px);transform: translateX(5px);}
    .m-center-text{ 160px; height: 160px;line-height: 160px;font-size: 24px; border-radius: 50%;background: #ffffff;z-index: 99;}
    .m-radar {display: block;position: absolute;top: 0;left: 0; 300px;height: 300px;
        background-image: -webkit-linear-gradient(44deg, rgba(255, 255, 255, 0) 50%, #cccccc 100%);
        background-image: linear-gradient(44deg, rgba(255, 255, 255, 0) 50%, #cccccc 100%);
        -webkit-animation: radar-beam 5s infinite;
        animation: radar-beam 5s infinite;
        -webkit-animation-timing-function: linear;  
        animation-timing-function: linear;
        -webkit-transform-origin: bottom right;
        transform-origin: bottom right;border-radius: 100% 0 0 0;}
    .m-breathe-btn {display: inline-block;position:absolute; 10px; height:10px;border:1px solid transparent; border-radius:5px; color:#fff; font-size:20px; text-align:center;cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.3); overflow:hidden;background-image: -webkit-gradient(linear, left top, left bottom, from(#6cc3fe), to(#21a1d0));-webkit-animation-timing-function: ease-in-out;-webkit-animation-name: breathe;-webkit-animation-duration: 2700ms;-webkit-animation-iteration-count: infinite;-webkit-animation-direction: alternate;}
    @-webkit-keyframes breathe {
      0% { opacity: .2; box-shadow:0 1px 2px rgba(255,255,255,0.1);}
      100% { opacity: 1; border:1px solid rgba(59,235,235,1); box-shadow:0 1px 30px rgba(59,255,255,1);}
    }
    @keyframes breathe {
      0% { opacity: .2; box-shadow:0 1px 2px rgba(255,255,255,0.1);}
      100% { opacity: 1; border:1px solid rgba(59,235,235,1); box-shadow:0 1px 30px rgba(59,255,255,1);}
    }
    @-webkit-keyframes radar-beam {
      0% {-webkit-transform: rotate(0deg);transform: rotate(0deg);}
      100% {-webkit-transform: rotate(360deg);transform: rotate(360deg);}
    }
    @keyframes radar-beam {
      0% {-webkit-transform: rotate(0deg);transform: rotate(0deg);}
      100% {-webkit-transform: rotate(360deg);transform: rotate(360deg);}
    }
    
    </style>
    </head>
    <body>
    <div class="m-wrapper">
        <div class="m-center m-divison1">
            <div class="m-center m-divison2">
                <div class="m-center m-circle">
                    <div class="m-center m-center-text" id="m-center-text">3.64k</div>
                    <div class="m-circle-loading">
                        <span class="m-circle-loading-radius"></span>
                    </div>
                </div>
            </div>
        </div>
        <div class="m-radar"></div>
    </div>
    <script src="https://cdn.bootcss.com/jquery/1.9.0/jquery.js"></script>
    <script>
    $(function () {
        var dom = {
            centerText: $('#m-center-text')
        };
        var action = {
            initPage: function () {
                var height = $(document).height();
                var width = $(document).width();
                var count = 0;
                var myVar = setInterval(function () {
                    var top = Math.floor(Math.random() * (height - 100) + 100);
                    var left = Math.floor(Math.random() * (width - 200) + 100);
                    var breatheBtn = $('<div class="m-breathe-btn js-breathe-btn"></div>');
                    breatheBtn.css({top: top, left: left});
                    $(document.body).append(breatheBtn);             
                    var text = (Math.floor(Math.random() * 300) + 200) / 100 + 'k';
                    dom.centerText.text(text);
                    count++;
                    if (count >= 10) {
                        //clearInterval(myVar);
                        var totalBreatheBtn = $('.js-breathe-btn');
                        var length = totalBreatheBtn.length;
                        var index = Math.floor(Math.random() * length);
                        if (index < length) {
                            $(totalBreatheBtn[index]).remove();
                        }
                    }   
                }, 1000); 
            }
        }
        var init = function () {
            action.initPage();
        }();
    });
    </script>
    </body>
    </html>
    





  • 相关阅读:
    Nginx 学习笔记(七)如何解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    jQuery基础 (四)——使用jquery-cookie 实现点赞功能
    Travis CI实现持续部署
    三大云安全工具(CASB、CSPM、CWPP)的使用场景
    数据访问安全代理 CASB
    SDP(软件定义边界)让SDN更安全,你的对面可不能是一条狗!
    从BeyondCorp说起
    [Docker] Docker整体架构图
    当博弈论遇上机器学习:一文读懂相关理论
    用Rust重写Linux内核模块体验
  • 原文地址:https://www.cnblogs.com/xutongbao/p/9924847.html
Copyright © 2011-2022 走看看