BottomMenuSvg.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div class="test">
  3. <svg id="svgBox" @click="changeShowBottomMenusStatus()" width="300" height="180" viewBox="0 0 410 314" version="1.1" xmlns="http://www.w3.org/2000/svg">
  4. <!-- 正常边框渐变定义 -->
  5. <defs>
  6. <!-- 内容透明定义 -->
  7. <linearGradient id="grad1" x1="0%" y1="100%" x2="100%" y2="100%">
  8. <stop offset="0%" style="stop-color: #27ffff; stop-opacity: 0" />
  9. <stop offset="100%" style="stop-color: #27ffff; stop-opacity: 0.5" />
  10. </linearGradient>
  11. <!-- 内容渐变定义 -->
  12. <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%">
  13. <stop offset="0%" style="stop-color: #27cdff; stop-opacity: 0" />
  14. <stop offset="100%" style="stop-color: #27cdff; stop-opacity: 0.5" />
  15. </linearGradient>
  16. <!-- 第二层中部定义 -->
  17. <linearGradient id="grad2-2" x1="0%" y1="0%" x2="0%" y2="100%">
  18. <stop offset="0%" style="stop-color: #27cdffaa; stop-opacity: 1" />
  19. <stop offset="100%" style="stop-color: #27cdffaa; stop-opacity: 1" />
  20. </linearGradient>
  21. <!-- 左深右浅 -->
  22. <linearGradient id="grad2-3" x1="100%" y1="0%" x2="0%" y2="100%">
  23. <stop offset="0%" style="stop-color: #74ffff; stop-opacity: 1" />
  24. <stop offset="100%" style="stop-color: #0037ff; stop-opacity: 1" />
  25. </linearGradient>
  26. <linearGradient id="grad2-4" x1="100%" y1="100%" x2="100%" y2="0%">
  27. <stop offset="0%" style="stop-color: #27ffffaa; stop-opacity: 1" />
  28. <stop offset="100%" style="stop-color: #27cdff; stop-opacity: 0" />
  29. </linearGradient>
  30. <linearGradient id="grad2-5" x1="100%" y1="100%" x2="100%" y2="0%">
  31. <stop offset="0%" style="stop-color: #27ffff; stop-opacity: 1" />
  32. <stop offset="100%" style="stop-color: #27cdff; stop-opacity: 0" />
  33. </linearGradient>
  34. <!-- 浅色圆环 -->
  35. <linearGradient id="grad3" x1="0%" y1="0%" x2="0%" y2="100%">
  36. <stop offset="0%" style="stop-color: #74ffff64; stop-opacity: 0.5" />
  37. <stop offset="100%" style="stop-color: #74ffff; stop-opacity: 1" />
  38. </linearGradient>
  39. <!-- 深色圆环 -->
  40. <linearGradient id="grad4" x1="0%" y1="0%" x2="0%" y2="100%">
  41. <stop offset="0%" style="stop-color: #00aaff64; stop-opacity: 0.1" />
  42. <stop offset="100%" style="stop-color: #00244d; stop-opacity: 1" />
  43. </linearGradient>
  44. <!-- 圆盘面渐变颜色 -->
  45. <linearGradient id="shipGrad1" x1="100%" y1="0%" x2="0%" y2="0%">
  46. <stop offset="0%" style="stop-color: #5dd8d8; stop-opacity: 1" />
  47. <stop offset="100%" style="stop-color: #0037ff; stop-opacity: 1" />
  48. </linearGradient>
  49. <!-- ship内环背景渐变定义 -->
  50. <radialGradient id="coludFill" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
  51. <stop offset="80%" style="stop-color: #00000000; stop-opacity: 0" />
  52. <stop offset="100%" style="stop-color: #27cdff; stop-opacity: 1" />
  53. </radialGradient>
  54. </defs>
  55. <symbol>
  56. <!-- 定义组合(底座向上发光圆柱和向下流星) -->
  57. <g id="Upath1">
  58. <path d="M 0 0 L 100 0 L 100 50 Q 100,60 50,62 Q 0,60 0,50 L 0 50 z " fill="url(#grad2-4)" />
  59. <path d="M 38 25 L 62 25 L 62 50 Q 62,53 50,53 Q 38,53 38,50 L 38 50 z " fill="url(#grad2-5)" />
  60. <path class="svgPath index1" d="M 5 0 L 7 0 L 7 10 L 5 10 z" fill="url(#grad2-5)" />
  61. <path class="svgPath index2" d="M 15 0 L 17 0 L 17 10 L 15 10 z" fill="url(#grad2-5)" />
  62. <path class="svgPath index3" d="M 25 0 L 27 0 L 27 10 L 25 10 z" fill="url(#grad2-5)" />
  63. <path class="svgPath index4" d="M 35 0 L 37 0 L 37 10 L 35 10 z" fill="url(#grad2-5)" />
  64. <path class="svgPath index5" d="M 45 0 L 47 0 L 47 10 L 45 10 z" fill="url(#grad2-5)" />
  65. <path class="svgPath index6" d="M 55 0 L 57 0 L 57 10 L 55 10 z" fill="url(#grad2-5)" />
  66. <path class="svgPath index7" d="M 65 0 L 67 0 L 67 10 L 65 10 z" fill="url(#grad2-5)" />
  67. <path class="svgPath index8" d="M 40 10 L 42 10 L 42 15 L 40 15 z" fill="url(#grad2-5)" />
  68. <path class="svgPath index9" d="M 50 10 L 52 10 L 52 15 L 50 15 z" fill="url(#grad2-5)" />
  69. <path class="svgPath index10" d="M 60 10 L 62 10 L 62 15 L 60 15 z" fill="url(#grad2-5)" />
  70. <path class="svgPath index11" d="M 75 0 L 77 0 L 77 10 L 75 10 z" fill="url(#grad2-5)" />
  71. <path class="svgPath index12" d="M 85 0 L 87 0 L 87 10 L 85 10 z" fill="url(#grad2-5)" />
  72. <path class="svgPath index13" d="M 95 0 L 97 0 L 97 10 L 95 10 z" fill="url(#grad2-5)" />
  73. </g>
  74. <g width="22" height="26" x="0" y="0" id="userName">
  75. <image width="22" height="26" x="0" y="0"
  76. href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAaCAQAAAAZf2TLAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
  77. AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElN
  78. RQfmDAQHExw2+iMxAAABJElEQVQ4y5XTsUoDQRDG8f8cCQiaVtMICSaNWKoIeQDt7G0Um6TRUrFX
  79. X0FFQVEI9oLgAwRBzjfQRBA0sfQQIhcYC2O8c/dy61ft7fwYdmc5IRYtUWOBEaDLLYfyGK1KjC6z
  80. QyayEbIvV1ascxxgpir3P0svsr2NLVu/ywHWGQpWPKXTZucySSmbOJuIMyZ+ScSvJvb5sNIAcxrS
  81. 5cSKj+XTMjq54Mag11KPiHhNV1kj1/9450zOo1X520pHmaUAPOGL/RZu6XfWHCvMkyeLxqohbe6o
  82. SzDAOs4Rk0NaPlOVNxDQMU4pppygxboEHrCXSqHILni6RMXpdhVdFL2k5DiMB1HffXSeO/03bjrb
  83. lscmDXqpsEeDje8XnCA/5LeCkI604QvrnkULlWJvSgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0x
  84. Mi0wNFQwNjoxOToyOCswMTowMLMm2+oAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMTItMDRUMDY6
  85. MTk6MjgrMDE6MDDCe2NWAAAAAElFTkSuQmCC" />
  86. </g>
  87. </symbol>
  88. <!-- 底部圆饼外环 -->
  89. <ellipse cx="210" cy="268" rx="180" ry="45" stroke="url(#grad3)" fill="url(#grad1)" style="stroke-width: 4" />
  90. <!-- 底部圆饼中环 -->
  91. <ellipse
  92. class="strokeDashoffset2"
  93. cx="210"
  94. cy="268"
  95. rx="157"
  96. ry="40"
  97. stroke="url(#grad3)"
  98. stroke-dasharray="50,5"
  99. style="fill: #00000000; stroke-width: 2"
  100. />
  101. <!-- 底部圆饼内环 -->
  102. <ellipse
  103. class="strokeDashoffset2"
  104. cx="210"
  105. cy="258"
  106. rx="117"
  107. ry="30"
  108. stroke="url(#grad3)"
  109. stroke-dasharray="5,5"
  110. style="fill: #00000000; stroke-width: 2"
  111. />
  112. <!-- 第二层底部台座 -->
  113. <ellipse cx="210" cy="250" rx="90.6" ry="22.4" stroke="url(#grad3)" style="fill: #00244d; stroke-width: 10" />
  114. <!-- 第二层底部外环 -->
  115. <ellipse cx="210" cy="248" rx="93.6" ry="23.4" stroke="url(#grad4)" fill="url(#shipGrad1)" style="stroke-width: 2" />
  116. <!-- 第二层底部中环 -->
  117. <ellipse
  118. class="strokeDashoffset3"
  119. cx="210"
  120. cy="247"
  121. rx="80"
  122. ry="20"
  123. stroke="url(#grad3)"
  124. style="fill: #00000000; stroke-width: 2"
  125. />
  126. <!-- 第二层底部中内环 -->
  127. <ellipse
  128. class="strokeDashoffset2"
  129. cx="210"
  130. cy="247"
  131. rx="75"
  132. ry="18"
  133. stroke="url(#grad3)"
  134. style="fill: #00000000; stroke-width: 1"
  135. />
  136. <!-- 第二层底部内环 -->
  137. <ellipse cx="210" cy="246" rx="45" ry="10" stroke="url(#grad3)" fill="url(#grad2-2)" style="stroke-width: 0" />
  138. <!-- 第二层内环外圆饼 -->
  139. <ellipse cx="210" cy="246" rx="50" ry="12" stroke="url(#grad3)" fill="url(#grad2-2)" style="stroke-width: 0" />
  140. <!-- 第二层内环内圆饼 -->
  141. <ellipse cx="210" cy="246" rx="28" ry="7" stroke="url(#grad3)" fill="url(#grad2-3)" style="stroke-width: 0" />
  142. <ellipse cx="210" cy="246" rx="25" ry="6" stroke="url(#grad3)" fill="url(#shipGrad1)" style="stroke-width: 0" />
  143. <ellipse cx="210" cy="246" rx="15" ry="4" stroke="url(#grad3)" fill="url(#grad2-3)" style="stroke-width: 0" />
  144. <ellipse cx="210" cy="246" rx="12" ry="3" stroke="url(#grad3)" fill="#74ffff" style="stroke-width: 0" />
  145. <!-- 组合显示(圆盘中部光柱和流星效果) -->
  146. <use x="160" y="196" width="100" height="50" xlink:href="#Upath1" />
  147. </svg>
  148. </div>
  149. </template>
  150. <script>
  151. /**
  152. * 底部菜单底座组件
  153. * @author: LiuMengxiang
  154. * @Date: 2022年11月14-18日
  155. */
  156. export default {
  157. name: "BottomMenuSvg",
  158. components: {},
  159. data() {
  160. return {};
  161. },
  162. mounted() {},
  163. props: [],
  164. methods: {
  165. // 绑定并抛出用户点击svg事件,实现底部菜单显示隐藏切换。
  166. changeShowBottomMenusStatus(){
  167. this.$emit('changeShowBottomMenusStatus');
  168. }
  169. },
  170. watch: {}
  171. };
  172. </script>
  173. <style>
  174. .test {
  175. display: flex;
  176. position: relative;
  177. justify-content: center;
  178. }
  179. #svgBox {
  180. cursor: pointer;
  181. position: absolute;
  182. bottom: 0px;
  183. }
  184. svg .strokeDashoffset2 {
  185. stroke-dasharray: 10;
  186. stroke-dashoffset: 0;
  187. animation: dash 5s linear infinite;
  188. }
  189. svg .strokeDashoffset3 {
  190. stroke-dasharray: 8;
  191. stroke-dashoffset: 0;
  192. animation: dash2 3s linear infinite;
  193. }
  194. svg .svgPath {
  195. transform: rotate(-90deg);
  196. offset-path: path("M0 0 L0 40");
  197. offset-distance: 0%;
  198. opacity: 0;
  199. }
  200. svg .index1 {
  201. animation: ball 2.2s linear 0s infinite;
  202. }
  203. svg .index2 {
  204. animation: ball 0.7s linear 0.3s infinite;
  205. }
  206. svg .index3 {
  207. animation: ball 1.8s linear 0.9s infinite;
  208. }
  209. svg .index4 {
  210. animation: ball 2.2s linear 1.1s infinite;
  211. }
  212. svg .index5 {
  213. animation: ball 2.5s linear 1.7s infinite;
  214. }
  215. svg .index6 {
  216. animation: ball 2s linear 1.9s infinite;
  217. }
  218. svg .index7 {
  219. animation: ball 0.4s linear 0.1s infinite;
  220. }
  221. svg .index8 {
  222. animation: ball 0.5s linear 0.2s infinite;
  223. }
  224. svg .index9 {
  225. animation: ball 1.4s linear 0.7s infinite;
  226. }
  227. svg .index10 {
  228. animation: ball 1.6s linear 0.8s infinite;
  229. }
  230. svg .index11 {
  231. animation: ball 1s linear 0.5s infinite;
  232. }
  233. svg .index12 {
  234. animation: ball 1.5s linear 0.7s infinite;
  235. }
  236. svg .index13 {
  237. animation: ball 2s linear 1.3s infinite;
  238. }
  239. @keyframes dash {
  240. from {
  241. stroke-dashoffset: 100;
  242. }
  243. to {
  244. stroke-dashoffset: 0;
  245. }
  246. }
  247. @keyframes dash2 {
  248. from {
  249. stroke-dashoffset: 0;
  250. }
  251. to {
  252. stroke-dashoffset: 100;
  253. }
  254. }
  255. @keyframes ball {
  256. 0% {
  257. offset-distance: 0%;
  258. opacity: 0;
  259. }
  260. 50% {
  261. offset-distance: 50%;
  262. opacity: 1;
  263. }
  264. 100% {
  265. offset-distance: 100%;
  266. opacity: 0;
  267. }
  268. }
  269. </style>