效果图:

 

 

 

HTML代码:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <link rel="stylesheet" href="../scss/IOS.css" />
  7. <script src="../js/jquery/jquery-3.6.0.js"></script>
  8. </head>
  9. <body>
  10. <div class="g-container">
  11. <div class="g-number" id="div_text" style="margin-top: -74px;"></div>
  12. <div class="g-contrast">
  13. <div class="g-circle"></div>
  14. <ul class="g-bubbles">
  15. <li></li>
  16. <li></li>
  17. <li></li>
  18. <li></li>
  19. <li></li>
  20. <li></li>
  21. <li></li>
  22. <li></li>
  23. <li></li>
  24. <li></li>
  25. <li></li>
  26. <li></li>
  27. <li></li>
  28. <li></li>
  29. <li></li>
  30. </ul>
  31. </div>
  32. </div>
  33. <script>
  34. var a=0;
  35. var b=0;
  36. var c=0;
  37. var d=0;
  38. var time=$("#div_text").val();
  39. setInterval(function (){
  40. d++
  41. if(d==9){
  42. d=0;
  43. c++;
  44. } else if(c==9){
  45. c=0;
  46. b++;
  47. }else if(b==9){
  48. a++;
  49. b=0;
  50. }
  51. if(b==9){
  52. a++;
  53. b=0;
  54. }
  55. if(a == 10){
  56. clearInterval(interval);
  57. }
  58. $("#div_text").text(a+""+b+"."+c+""+d+"%");
  59. },1);
  60. </script>
  61. </body>
  62. </html>

 

SCSS代码(这里我是用考拉编译成css的,如果有不会的朋友可以参考我的另一篇文章课程学习中的SCSS):

  1. html,
  2. body {
  3. width: 100%;
  4. height: 100%;
  5. display: flex;
  6. background: #000000;
  7. overflow: hidden;
  8. }
  9. .g-number {
  10. position: absolute;
  11. width: 300px;
  12. top: 27%;
  13. text-align: center;
  14. font-size: 32px;
  15. z-index: 10;
  16. color: #fff;
  17. }
  18. .g-container {
  19. position: relative;
  20. width: 300px;
  21. height: 400px;
  22. margin: auto;
  23. }
  24. .g-contrast {
  25. filter: contrast(10) hue-rotate(0);
  26. width: 300px;
  27. margin-top: -70px;
  28. height: 600px;
  29. background-color: #000;
  30. overflow: hidden;
  31. animation: hueRotate 10s infinite linear;
  32. }
  33. .g-circle {
  34. position: relative;
  35. width: 300px;
  36. height: 300px;
  37. box-sizing: border-box;
  38. filter: blur(8px);
  39. &::after {
  40. content: "";
  41. position: absolute;
  42. top: 40%;
  43. left: 50%;
  44. transform: translate(-50%, -50%) rotate(0);
  45. width: 200px;
  46. height: 200px;
  47. background-color: #00ff6f;
  48. border-radius: 42% 38% 62% 49% / 45%;
  49. animation: rotate 2s infinite linear;
  50. }
  51. &::before {
  52. content: "";
  53. position: absolute;
  54. width: 176px;
  55. height: 176px;
  56. top: 40%;
  57. left: 50%;
  58. transform: translate(-50%, -50%);
  59. border-radius: 50%;
  60. background-color: #000;
  61. z-index: 10;
  62. }
  63. }
  64. .g-bubbles {
  65. position: absolute;
  66. left: 50%;
  67. bottom: 0;
  68. width: 100px;
  69. height: 40px;
  70. transform: translate(-50%, 0);
  71. border-radius: 100px 100px 0 0;
  72. background-color: #00ff6f;
  73. filter: blur(5px);
  74. }
  75. li {
  76. position: absolute;
  77. border-radius: 50%;
  78. background: #00ff6f;
  79. }
  80. @for $i from 0 through 15 {
  81. li:nth-child(#{$i}) {
  82. $width: 15 + random(15) + px;
  83. left: 10 + random(70) + px;
  84. top:50%;
  85. transform: translate(-50%, -50%);
  86. width: $width;
  87. height: $width;
  88. animation: moveToTop #{random(1) + 0}s ease-in-out -#{random(5000)/1000}s infinite;
  89. }
  90. }
  91. @keyframes rotate {
  92. 50% {
  93. border-radius: 45% / 42% 38% 58% 49%;
  94. }
  95. 100% {
  96. transform: translate(-50%, -50%) rotate(720deg);
  97. }
  98. }
  99. @keyframes moveToTop {
  100. 90% {
  101. opacity: 1;
  102. }
  103. 100% {
  104. opacity: .1;
  105. transform: translate(-10%, -330px);
  106. }
  107. }
  108. @keyframes hueRotate {
  109. 100% {
  110. filter: contrast(15) hue-rotate(360deg);
  111. }
  112. }