• html设计(两种常见的充电效果)


    第一种

    完整代码:

    1. html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <title>Documenttitle>
    7. <style>
    8. *{
    9. padding: 0;
    10. margin: 0;
    11. }
    12. .box{
    13. width: 800px;
    14. height: 800px;
    15. background-color: black;
    16. margin: 20px auto;
    17. padding-top: 20px;
    18. position: relative;
    19. }
    20. .battery{
    21. width: 200px;
    22. height: 320px;
    23. background-color:white;
    24. margin-top: 200px;
    25. margin-left: 300px;
    26. border-radius: 15px 15px 0px 0px;
    27. position: relative;
    28. /* top: 20px; */
    29. }
    30. .battery::before{
    31. content: "";
    32. width: 50px;
    33. height: 20px;
    34. background-color:white;
    35. position: absolute;
    36. top: -20px;
    37. left: 38%;
    38. }
    39. .battery::after{
    40. content: "";
    41. position: absolute;
    42. top: 90%;
    43. left: 0;
    44. right: 0;
    45. bottom: 0;
    46. background-image: linear-gradient(to bottom,#7abcff 0%,#00BCD4
    47. 44%,#2196F3 100%);
    48. animation:change 10s linear infinite ;
    49. }
    50. @keyframes change{
    51. 0%{
    52. top: 100%;
    53. filter: hue-rotate(90deg);
    54. }
    55. 95%{
    56. top: 5%;
    57. border-radius: 0;
    58. }
    59. 100%{
    60. top: 0%;
    61. border-radius: 15px 15px 0px 0px;
    62. filter: hue-rotate(0deg);
    63. }
    64. }
    65. .cover{
    66. width: 100%;
    67. height: 100%;
    68. /* background-color: #00BCD4; */
    69. border-radius: 15px 15px 0px 0px;
    70. position: absolute;
    71. top: 0;
    72. left: 0;
    73. z-index: 1;
    74. overflow: hidden;
    75. }
    76. .cover::before{
    77. content: "";
    78. width: 400px;
    79. height: 400px;
    80. background-color: rgba(255, 255, 255, 0.8);
    81. position: absolute;
    82. left: -50%;
    83. border-radius: 42% 40%;
    84. animation: coverBefore 10s linear infinite;
    85. }
    86. @keyframes coverBefore{
    87. 0%{
    88. transform: rotate(0deg);
    89. bottom: 0%;
    90. }
    91. 100%{
    92. transform: rotate(360deg);
    93. bottom: 100%;
    94. }
    95. }
    96. .cover::after{
    97. content: "";
    98. width: 400px;
    99. height: 400px;
    100. background-color: rgba(255, 255, 255, 0.7);
    101. position: absolute;
    102. left: -50%;
    103. border-radius: 42% 40%;
    104. animation: coverAfter 10s linear infinite;
    105. }
    106. @keyframes coverAfter{
    107. 0%{
    108. transform: rotate(30deg);
    109. bottom: 2%;
    110. }
    111. 100%{
    112. transform: rotate(360deg);
    113. bottom: 95%;
    114. }
    115. }
    116. style>
    117. head>
    118. <body>
    119. <div class="box">
    120. <div class="battery">
    121. <div class="cover">div>
    122. body>
    123. html>

    第二种

    完整代码:

    1. html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <title>充电效果title>
    7. <style>
    8. *{
    9. padding: 0;
    10. margin: 0;
    11. }
    12. /* .box{
    13. width: 1000px;
    14. height:1000px;
    15. background-color: black;
    16. margin: 20px auto;
    17. padding-top: 20px;
    18. position: relative;
    19. } */
    20. .contrast{
    21. width: 70%;
    22. height: 70%;
    23. background-color:black;
    24. position: absolute;
    25. top: 20px;
    26. left: 20%;
    27. filter: contrast(15);
    28. animation: hueRotate 5s linear infinite;
    29. }
    30. @keyframes hueRotate{
    31. 0%{
    32. filter: contrast(15) hue-rotate(0);
    33. }
    34. 100%{
    35. filter: contrast(15) hue-rotate(360deg);
    36. }
    37. }
    38. .circle{
    39. width: 300px;
    40. height: 300px;
    41. /* background-color: #2196F3; */
    42. position: absolute;
    43. top: 0;
    44. left: 50%;
    45. margin-left: -150px;
    46. filter: blur(8px);
    47. animation: circleRotate 5s linear infinite;
    48. }
    49. @keyframes circleRotate{
    50. 0%{
    51. transform: rotate(0);
    52. }
    53. 100%{
    54. transform: rotate(360deg);
    55. }
    56. }
    57. .circle::before{
    58. content: "";
    59. width: 200px;
    60. height: 200px;
    61. background-color: #00ff6f;
    62. position: absolute;
    63. top: 50%;
    64. left: 50%;
    65. border-radius: 42% 38% 64% 49%/45%;
    66. transform: translate(-50%,-50%);
    67. }
    68. .circle::after{
    69. content: "";
    70. width: 180px;
    71. height: 178px;
    72. background-color: black;
    73. position: absolute;
    74. top: 50%;
    75. left: 50%;
    76. border-radius: 50%;
    77. transform: translate(-50%,-50%);
    78. }
    79. .number{
    80. width: 200px;
    81. height: 200px;
    82. color: white;
    83. font-size: 30px;
    84. position: absolute;
    85. top: 9%;
    86. left: 55%;
    87. z-index: 1;
    88. line-height: 200px;
    89. text-align: center;
    90. margin-left: -100px;
    91. }
    92. .bubble_home{
    93. width: 150px;
    94. height: 50px;
    95. background-color: #00ff6f;
    96. position: absolute;
    97. bottom: 0;
    98. left: 45%;
    99. border-radius: 150px 150px 15px 15px;
    100. filter: blur(8px);
    101. }
    102. .bubble{
    103. /* width: 20px;
    104. height: 20px;
    105. background-color:#00ff6f;
    106. border-radius: 100%; */
    107. position: absolute;
    108. left: 50%;
    109. bottom: 0;
    110. z-index: 1;
    111. animation:bubbleMoveUp 5s ease-in-out infinite ;
    112. }
    113. @keyframes bubbleMoveUp{
    114. 0%{
    115. bottom: 0;
    116. }
    117. 100%{
    118. bottom: calc(100% - 260px);
    119. }
    120. }
    121. .bubble:nth-child(1){
    122. width: 20px;
    123. height: 20px;
    124. background-color:#00ff6f;
    125. border-radius: 100%;
    126. animation-duration: 5s;
    127. animation-delay: 1s;
    128. left: 50%;
    129. }
    130. .bubble:nth-child(2){
    131. width: 18px;
    132. height: 18px;
    133. background-color:#00ff6f;
    134. border-radius: 100%;
    135. animation-duration: 7s;
    136. animation-delay: 3s;
    137. left: 47%;
    138. }
    139. .bubble:nth-child(3){
    140. width: 22px;
    141. height: 22px;
    142. background-color:#00ff6f;
    143. border-radius: 100%;
    144. animation-duration: 3s;
    145. animation-delay: 0.5s;
    146. left: 51%;
    147. }
    148. .bubble:nth-child(4){
    149. width: 18px;
    150. height: 18px;
    151. background-color:#00ff6f;
    152. border-radius: 100%;
    153. animation-duration: 4s;
    154. animation-delay: 0s;
    155. left: 50%;
    156. }
    157. .bubble:nth-child(5){
    158. width: 20px;
    159. height: 18px;
    160. background-color:#00ff6f;
    161. border-radius: 100%;
    162. animation-duration: 7.5s;
    163. animation-delay: 3.6s;
    164. left: 48%;
    165. }
    166. .bubble:nth-child(6){
    167. width: 21px;
    168. height: 21px;
    169. background-color:#00ff6f;
    170. border-radius: 100%;
    171. animation-duration: 8s;
    172. animation-delay: 1.5s;
    173. left: 50%;
    174. }
    175. style>
    176. head>
    177. <body>
    178. <div class="box">
    179. div>
    180. <div class="number">95.3%div>
    181. <div class="contrast">
    182. <div class="bubble">div>
    183. <div class="bubble">div>
    184. <div class="bubble">div>
    185. <div class="bubble">div>
    186. <div class="bubble">div>
    187. <div class="bubble">div>
    188. <div class="bubble">div>
    189. <div class="bubble">div>
    190. <div class="bubble">div>
    191. <div class="bubble">div>
    192. <div class="bubble">div>
    193. <div class="bubble">div>
    194. <div class="bubble">div>
    195. <div class="bubble">div>
    196. <span class="bubble_home">span>
    197. <div class="circle">div>
    198. div>
    199. div>
    200. body>
    201. html>

  • 相关阅读:
    nat的基础配置(动态nat,nat server)
    一文搞懂cookie与session
    2023-10-14:用go语言,给定 pushed 和 popped 两个序列,每个序列中的 值都不重复, 只有当它们可能是在最初空栈上进行的推入 push 和弹出 pop 操作序列的结果时, 返回
    leetcode做题笔记179. 最大数
    举个栗子~Minitab 技巧(4):自定义缩放图形或数据显示
    如何做好测试?(一)不就是功能测试和性能测试?
    代码随想录-014-剑指Offer707.设计链表
    redis能否替代threadlocal
    浅谈C++
    防火墙NAT实验(接上一个用认证实验)
  • 原文地址:https://blog.csdn.net/2301_81704123/article/details/140387705