定制网站大数据热点城市波动图案例【CSS3实现 + 原理分析 + 源码获取】

一:案例效果

       定制网站本次案例我们分析一下定制网站数据可视化页面最常见定制网站的热点图是如何实现的,定制网站其原理并不复杂,定制网站只需要用到属性 animation 以及 @keyframe 定制网站关键帧即可,定制网站重点是向外扩散的环如定制网站何布局比较合适,以及每个环怎么扩散何时扩散比较合适。

二:源码获取

源码我已经上传到了资源里,想拿来学习引用的小伙伴直接下载即可,没有会员的可以私聊我 “大数据热点图” 免费获取,下方是源码的资源链接


三:原理分析

原理分析我们分为热点的布局分析与热点向外扩散的动画实现的分析

3.1 布局分析

  • 布局我们那单独的一个城市分析,例如地图中北京的 ,其由一个类名为city1的最外层盒子来添加定位以定到目标城市位置,其不设置宽高,大小完全由中心点撑起(即第二个类名为center的盒子) ,波纹其实是有三个圈圈组成的,最开始是完全重合的,用中心小算法来保证其永远是围绕center来扩散的。
  1. <div class="city1">
  2. <div class="center1"></div>
  3. <p class="bj">Beijing</p>
  4. <div class="bw1"></div>
  5. <div class="bw2"></div>
  6. <div class="bw3"></div>
  7. </div>
  • 波纹的样式添加我们采用了属性选择器 .city1 div[class^="bw"],即选择父类city1里面类名以bw开头的所有子div标签 
  1. .city1{
  2. position: absolute;
  3. top: 370px;
  4. right: 403px;
  5. color: aliceblue;
  6. }
  7. .center1{
  8. width: 5px;
  9. height: 5px;
  10. background-color: rgb(255, 255, 255);
  11. box-shadow: 0 0 12px 2px #fff;
  12. border-radius: 50%;
  13. }
  14. .city1 div[class^="bw"]{
  15. position: absolute;
  16. top: 50%;
  17. left: 50%;
  18. transform: translate(-50%,-50%);
  19. width: 5px;
  20. height: 5px;
  21. box-shadow: 0 0 7px #fff;
  22. border-radius: 50%;
  23. animation: scla 3s linear infinite;
  24. }
  25. .map .city1 div.bw2{
  26. animation-delay: 1s;
  27. }
  28. .map .city1 div.bw3{
  29. animation-delay: 2s;
  30. }

3.2 动画分析

  • 本次添加的关键帧为:0%的时候波纹是完全不透明的,50%的时候宽高均变大为105px,即圈圈在总动画时间50%的时候要从宽高5px扩散到宽高105px,然后变为半透明状态。再下一个是100%的时候,扩散到宽高150px,并变成完全不透明。要给波纹添加属性:animation: scla 3s linear infinite;  含义为3s做完动画,匀速,并且无限循环

     

  • 为了呈现出波纹一个接一个往外扩散而不是一起扩散,需要给第一个圈圈直接开始扩散,第二个圈圈第三个圈圈设置不同的 animation-delay 动画延迟,第二个设置为1s,第二个设置为2s,这样就可以呈现出一个接一个往外扩散了
  1. /* @keyframes关键帧动画 */
  2. @keyframes scla{
  3. 0% {
  4. opacity: 1;
  5. }
  6. 50% {
  7. width: 105px;
  8. height: 105px;
  9. opacity: 0.5;
  10. }
  11. 100% {
  12. width: 150px;
  13. height: 150px;
  14. opacity: 0;
  15. }
  16. }
  17. .city3 div[class^="bw"]{
  18. position: absolute;
  19. top: 50%;
  20. left: 50%;
  21. transform: translate(-50%,-50%);
  22. width: 5px;
  23. height: 5px;
  24. box-shadow: 0 0 7px #fff;
  25. border-radius: 50%;
  26. animation: scla 3s linear infinite;
  27. }
  28. .map .city3 div.bw2{
  29. animation-delay: 1s;
  30. }
  31. .map .city3 div.bw3{
  32. animation-delay: 2s;
  33. }

四:主要代码

  1. <style>
  2. *{
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. body{
  8. background-color: rgb(45, 45, 45);
  9. }
  10. .map{
  11. position: relative;
  12. width: 1400px;
  13. height: 830px;
  14. background-image: url(./img/QX3OPNW5qY.png);
  15. background-repeat: no-repeat;
  16. background-size: 100%;
  17. margin: 0 auto;
  18. }
  19. .bj{
  20. position: absolute;
  21. top: 15px;
  22. left: 10px;
  23. font-size: 10px;
  24. }
  25. .Gambia{
  26. position: absolute;
  27. top: 15px;
  28. left: 10px;
  29. font-size: 10px;
  30. color:rgb(255, 153, 153)
  31. }
  32. .Island{
  33. position: absolute;
  34. top: 15px;
  35. left: 10px;
  36. font-size: 10px;
  37. }
  38. /* 城市1 */
  39. .city1{
  40. position: absolute;
  41. top: 370px;
  42. right: 403px;
  43. color: aliceblue;
  44. }
  45. .center1{
  46. width: 5px;
  47. height: 5px;
  48. background-color: rgb(255, 255, 255);
  49. box-shadow: 0 0 12px 2px #fff;
  50. border-radius: 50%;
  51. }
  52. .city1 div[class^="bw"]{
  53. position: absolute;
  54. top: 50%;
  55. left: 50%;
  56. transform: translate(-50%,-50%);
  57. width: 5px;
  58. height: 5px;
  59. box-shadow: 0 0 7px #fff;
  60. border-radius: 50%;
  61. animation: scla 3s linear infinite;
  62. }
  63. .map .city1 div.bw2{
  64. animation-delay: 1s;
  65. }
  66. .map .city1 div.bw3{
  67. animation-delay: 2s;
  68. }
  69. /* 城市2 */
  70. .city2{
  71. position: absolute;
  72. top: 500px;
  73. right: 703px;
  74. color: aliceblue;
  75. }
  76. .center2{
  77. width: 5px;
  78. height: 5px;
  79. background-color: rgb(255, 255, 255);
  80. box-shadow: 0 0 12px 2px #fff;
  81. border-radius: 50%;
  82. }
  83. .city2 div[class^="bw"]{
  84. position: absolute;
  85. top: 50%;
  86. left: 50%;
  87. transform: translate(-50%,-50%);
  88. width: 5px;
  89. height: 5px;
  90. box-shadow: 0 0 7px rgb(255, 149, 149);
  91. border-radius: 50%;
  92. animation: scla1 3s linear infinite;
  93. }
  94. .map .city2 div.bw2{
  95. animation-delay: 0.75s;
  96. }
  97. .map .city2 div.bw3{
  98. animation-delay: 1.5s;
  99. }
  100. .map .city2 div.bw4{
  101. animation-delay: 2.25s;
  102. }
  103. /* 城市3 */
  104. .city3{
  105. position: absolute;
  106. top: 200px;
  107. right: 1003px;
  108. color: aliceblue;
  109. }
  110. .center3{
  111. width: 5px;
  112. height: 5px;
  113. background-color: rgb(255, 255, 255);
  114. box-shadow: 0 0 12px 2px #fff;
  115. border-radius: 50%;
  116. }
  117. /* 属性选择器 正则表达式筛选bw开头类名 */
  118. .city3 div[class^="bw"]{
  119. position: absolute;
  120. top: 50%;
  121. left: 50%;
  122. transform: translate(-50%,-50%);
  123. width: 5px;
  124. height: 5px;
  125. box-shadow: 0 0 7px #fff;
  126. border-radius: 50%;
  127. animation: scla 3s linear infinite;
  128. }
  129. .map .city3 div.bw2{
  130. animation-delay: 1s;
  131. }
  132. .map .city3 div.bw3{
  133. animation-delay: 2s;
  134. }
  135. /* @keyframes关键帧动画 */
  136. @keyframes scla{
  137. 0% {
  138. opacity: 1;
  139. }
  140. 50% {
  141. width: 105px;
  142. height: 105px;
  143. opacity: 0.5;
  144. }
  145. 100% {
  146. width: 150px;
  147. height: 150px;
  148. opacity: 0;
  149. }
  150. }
  151. @keyframes scla1{
  152. 0% {
  153. opacity: 1;
  154. }
  155. 50% {
  156. width: 285px;
  157. height: 285px;
  158. opacity: 0.5;
  159. }
  160. 100% {
  161. width: 330px;
  162. height: 330px;
  163. opacity: 0;
  164. }
  165. }
  166. </style>
  167. </head>
  168. <body>
  169. <div class="map">
  170. <div class="city1">
  171. <div class="center1"></div>
  172. <p class="bj">Beijing</p>
  173. <div class="bw1"></div>
  174. <div class="bw2"></div>
  175. <div class="bw3"></div>
  176. </div>
  177. <div class="city2">
  178. <div class="center2"></div>
  179. <p class="Gambia">Gambia</p>
  180. <div class="bw1"></div>
  181. <div class="bw2"></div>
  182. <div class="bw3"></div>
  183. <div class="bw4"></div>
  184. </div>
  185. <div class="city3">
  186. <div class="center3"></div>
  187. <p class="Island">Island</p>
  188. <div class="bw1"></div>
  189. <div class="bw2"></div>
  190. <div class="bw3"></div>
  191. </div>
  192. </div>
  193. </body>

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发