找回密码
 立即注册

QQ登录

只需一步,快速开始

ZenosZeng 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2021-1-28 23:56  /   查看:2493  /  回复:2
在仪表板设计时,经常需要添加一些动效来提升视觉冲击力,这个帖子主要介滑动的流星。

实现步骤:
1、在仪表板中添加外部扩展
image.png795945434.png

2、将以下代码粘贴到外部扩展的Html视图中,点击确定
image.png893712768.png
  1. <html>
  2. <head>
  3. <style>
  4. body {
  5.   height: 100vh;
  6.   overflow: hidden;
  7.   display: flex;
  8.   font-family: "Anton", sans-serif;
  9.   justify-content: center;
  10.   align-items: center;
  11. }

  12. .night {
  13.   position: relative;
  14.   width: 100%;
  15.   height: 100%;
  16.   transform: rotateZ(45deg);
  17. }

  18. .shooting_star {
  19.   position: absolute;
  20.   left: 50%;
  21.   top: 50%;
  22.   height: 2px;
  23.   background: linear-gradient(-45deg, #5f91ff, rgba(0, 0, 255, 0));
  24.   border-radius: 999px;
  25.   filter: drop-shadow(0 0 6px #699bff);
  26.   -webkit-animation: tail 3000ms ease-in-out infinite, shooting 3000ms ease-in-out infinite;
  27.           animation: tail 3000ms ease-in-out infinite, shooting 3000ms ease-in-out infinite;
  28. }
  29. .shooting_star::before {
  30.   content: "";
  31.   position: absolute;
  32.   top: calc(50% - 1px);
  33.   right: 0;
  34.   height: 2px;
  35.   background: linear-gradient(-45deg, rgba(0, 0, 255, 0), #5f91ff, rgba(0, 0, 255, 0));
  36.   transform: translateX(50%) rotateZ(45deg);
  37.   border-radius: 100%;
  38.   -webkit-animation: shining 3000ms ease-in-out infinite;
  39.           animation: shining 3000ms ease-in-out infinite;
  40. }
  41. .shooting_star::after {
  42.   content: "";
  43.   position: absolute;
  44.   top: calc(50% - 1px);
  45.   right: 0;
  46.   height: 2px;
  47.   background: linear-gradient(-45deg, rgba(0, 0, 255, 0), #5f91ff, rgba(0, 0, 255, 0));
  48.   transform: translateX(50%) rotateZ(45deg);
  49.   border-radius: 100%;
  50.   -webkit-animation: shining 3000ms ease-in-out infinite;
  51.           animation: shining 3000ms ease-in-out infinite;
  52.   transform: translateX(50%) rotateZ(-45deg);
  53. }
  54. .shooting_star:nth-child(1) {
  55.   top: calc(50% - 104px);
  56.   left: calc(50% - 300px);
  57.   -webkit-animation-delay: 4574ms;
  58.           animation-delay: 4574ms;
  59. }
  60. .shooting_star:nth-child(1)::before, .shooting_star:nth-child(1)::after {
  61.   -webkit-animation-delay: 4574ms;
  62.           animation-delay: 4574ms;
  63. }
  64. .shooting_star:nth-child(2) {
  65.   top: calc(50% - 153px);
  66.   left: calc(50% - 183px);
  67.   -webkit-animation-delay: 813ms;
  68.           animation-delay: 813ms;
  69. }
  70. .shooting_star:nth-child(2)::before, .shooting_star:nth-child(2)::after {
  71.   -webkit-animation-delay: 813ms;
  72.           animation-delay: 813ms;
  73. }
  74. .shooting_star:nth-child(3) {
  75.   top: calc(50% - -166px);
  76.   left: calc(50% - 161px);
  77.   -webkit-animation-delay: 9519ms;
  78.           animation-delay: 9519ms;
  79. }
  80. .shooting_star:nth-child(3)::before, .shooting_star:nth-child(3)::after {
  81.   -webkit-animation-delay: 9519ms;
  82.           animation-delay: 9519ms;
  83. }
  84. .shooting_star:nth-child(4) {
  85.   top: calc(50% - 176px);
  86.   left: calc(50% - 163px);
  87.   -webkit-animation-delay: 9645ms;
  88.           animation-delay: 9645ms;
  89. }
  90. .shooting_star:nth-child(4)::before, .shooting_star:nth-child(4)::after {
  91.   -webkit-animation-delay: 9645ms;
  92.           animation-delay: 9645ms;
  93. }
  94. .shooting_star:nth-child(5) {
  95.   top: calc(50% - 98px);
  96.   left: calc(50% - 279px);
  97.   -webkit-animation-delay: 6788ms;
  98.           animation-delay: 6788ms;
  99. }
  100. .shooting_star:nth-child(5)::before, .shooting_star:nth-child(5)::after {
  101.   -webkit-animation-delay: 6788ms;
  102.           animation-delay: 6788ms;
  103. }
  104. .shooting_star:nth-child(6) {
  105.   top: calc(50% - -46px);
  106.   left: calc(50% - 235px);
  107.   -webkit-animation-delay: 6197ms;
  108.           animation-delay: 6197ms;
  109. }
  110. .shooting_star:nth-child(6)::before, .shooting_star:nth-child(6)::after {
  111.   -webkit-animation-delay: 6197ms;
  112.           animation-delay: 6197ms;
  113. }
  114. .shooting_star:nth-child(7) {
  115.   top: calc(50% - -130px);
  116.   left: calc(50% - 274px);
  117.   -webkit-animation-delay: 6205ms;
  118.           animation-delay: 6205ms;
  119. }
  120. .shooting_star:nth-child(7)::before, .shooting_star:nth-child(7)::after {
  121.   -webkit-animation-delay: 6205ms;
  122.           animation-delay: 6205ms;
  123. }
  124. .shooting_star:nth-child(8) {
  125.   top: calc(50% - -143px);
  126.   left: calc(50% - 173px);
  127.   -webkit-animation-delay: 8236ms;
  128.           animation-delay: 8236ms;
  129. }
  130. .shooting_star:nth-child(8)::before, .shooting_star:nth-child(8)::after {
  131.   -webkit-animation-delay: 8236ms;
  132.           animation-delay: 8236ms;
  133. }
  134. .shooting_star:nth-child(9) {
  135.   top: calc(50% - 98px);
  136.   left: calc(50% - 289px);
  137.   -webkit-animation-delay: 3801ms;
  138.           animation-delay: 3801ms;
  139. }
  140. .shooting_star:nth-child(9)::before, .shooting_star:nth-child(9)::after {
  141.   -webkit-animation-delay: 3801ms;
  142.           animation-delay: 3801ms;
  143. }
  144. .shooting_star:nth-child(10) {
  145.   top: calc(50% - -35px);
  146.   left: calc(50% - 177px);
  147.   -webkit-animation-delay: 7845ms;
  148.           animation-delay: 7845ms;
  149. }
  150. .shooting_star:nth-child(10)::before, .shooting_star:nth-child(10)::after {
  151.   -webkit-animation-delay: 7845ms;
  152.           animation-delay: 7845ms;
  153. }
  154. .shooting_star:nth-child(11) {
  155.   top: calc(50% - -125px);
  156.   left: calc(50% - 181px);
  157.   -webkit-animation-delay: 8729ms;
  158.           animation-delay: 8729ms;
  159. }
  160. .shooting_star:nth-child(11)::before, .shooting_star:nth-child(11)::after {
  161.   -webkit-animation-delay: 8729ms;
  162.           animation-delay: 8729ms;
  163. }
  164. .shooting_star:nth-child(12) {
  165.   top: calc(50% - -35px);
  166.   left: calc(50% - 97px);
  167.   -webkit-animation-delay: 5926ms;
  168.           animation-delay: 5926ms;
  169. }
  170. .shooting_star:nth-child(12)::before, .shooting_star:nth-child(12)::after {
  171.   -webkit-animation-delay: 5926ms;
  172.           animation-delay: 5926ms;
  173. }
  174. .shooting_star:nth-child(13) {
  175.   top: calc(50% - -85px);
  176.   left: calc(50% - 60px);
  177.   -webkit-animation-delay: 1679ms;
  178.           animation-delay: 1679ms;
  179. }
  180. .shooting_star:nth-child(13)::before, .shooting_star:nth-child(13)::after {
  181.   -webkit-animation-delay: 1679ms;
  182.           animation-delay: 1679ms;
  183. }
  184. .shooting_star:nth-child(14) {
  185.   top: calc(50% - 186px);
  186.   left: calc(50% - 70px);
  187.   -webkit-animation-delay: 2818ms;
  188.           animation-delay: 2818ms;
  189. }
  190. .shooting_star:nth-child(14)::before, .shooting_star:nth-child(14)::after {
  191.   -webkit-animation-delay: 2818ms;
  192.           animation-delay: 2818ms;
  193. }
  194. .shooting_star:nth-child(15) {
  195.   top: calc(50% - -125px);
  196.   left: calc(50% - 115px);
  197.   -webkit-animation-delay: 6864ms;
  198.           animation-delay: 6864ms;
  199. }
  200. .shooting_star:nth-child(15)::before, .shooting_star:nth-child(15)::after {
  201.   -webkit-animation-delay: 6864ms;
  202.           animation-delay: 6864ms;
  203. }
  204. .shooting_star:nth-child(16) {
  205.   top: calc(50% - 73px);
  206.   left: calc(50% - 9px);
  207.   -webkit-animation-delay: 1772ms;
  208.           animation-delay: 1772ms;
  209. }
  210. .shooting_star:nth-child(16)::before, .shooting_star:nth-child(16)::after {
  211.   -webkit-animation-delay: 1772ms;
  212.           animation-delay: 1772ms;
  213. }
  214. .shooting_star:nth-child(17) {
  215.   top: calc(50% - -43px);
  216.   left: calc(50% - 135px);
  217.   -webkit-animation-delay: 2615ms;
  218.           animation-delay: 2615ms;
  219. }
  220. .shooting_star:nth-child(17)::before, .shooting_star:nth-child(17)::after {
  221.   -webkit-animation-delay: 2615ms;
  222.           animation-delay: 2615ms;
  223. }
  224. .shooting_star:nth-child(18) {
  225.   top: calc(50% - -92px);
  226.   left: calc(50% - 2px);
  227.   -webkit-animation-delay: 3037ms;
  228.           animation-delay: 3037ms;
  229. }
  230. .shooting_star:nth-child(18)::before, .shooting_star:nth-child(18)::after {
  231.   -webkit-animation-delay: 3037ms;
  232.           animation-delay: 3037ms;
  233. }
  234. .shooting_star:nth-child(19) {
  235.   top: calc(50% - -164px);
  236.   left: calc(50% - 44px);
  237.   -webkit-animation-delay: 6626ms;
  238.           animation-delay: 6626ms;
  239. }
  240. .shooting_star:nth-child(19)::before, .shooting_star:nth-child(19)::after {
  241.   -webkit-animation-delay: 6626ms;
  242.           animation-delay: 6626ms;
  243. }
  244. .shooting_star:nth-child(20) {
  245.   top: calc(50% - 14px);
  246.   left: calc(50% - 256px);
  247.   -webkit-animation-delay: 4858ms;
  248.           animation-delay: 4858ms;
  249. }
  250. .shooting_star:nth-child(20)::before, .shooting_star:nth-child(20)::after {
  251.   -webkit-animation-delay: 4858ms;
  252.           animation-delay: 4858ms;
  253. }

  254. @-webkit-keyframes tail {
  255.   0% {
  256.     width: 0;
  257.   }
  258.   30% {
  259.     width: 100px;
  260.   }
  261.   100% {
  262.     width: 0;
  263.   }
  264. }

  265. @keyframes tail {
  266.   0% {
  267.     width: 0;
  268.   }
  269.   30% {
  270.     width: 100px;
  271.   }
  272.   100% {
  273.     width: 0;
  274.   }
  275. }
  276. @-webkit-keyframes shining {
  277.   0% {
  278.     width: 0;
  279.   }
  280.   50% {
  281.     width: 30px;
  282.   }
  283.   100% {
  284.     width: 0;
  285.   }
  286. }
  287. @keyframes shining {
  288.   0% {
  289.     width: 0;
  290.   }
  291.   50% {
  292.     width: 30px;
  293.   }
  294.   100% {
  295.     width: 0;
  296.   }
  297. }
  298. @-webkit-keyframes shooting {
  299.   0% {
  300.     transform: translateX(0);
  301.   }
  302.   100% {
  303.     transform: translateX(300px);
  304.   }
  305. }
  306. @keyframes shooting {
  307.   0% {
  308.     transform: translateX(0);
  309.   }
  310.   100% {
  311.     transform: translateX(300px);
  312.   }
  313. }
  314. @-webkit-keyframes sky {
  315.   0% {
  316.     transform: rotate(45deg);
  317.   }
  318.   100% {
  319.     transform: rotate(405deg);
  320.   }
  321. }
  322. @keyframes sky {
  323.   0% {
  324.     transform: rotate(45deg);
  325.   }
  326.   100% {
  327.     transform: rotate(405deg);
  328.   }
  329. }
  330. </style>
  331. </head>
  332. <body>

  333. <div class="night">
  334.   <div class="shooting_star"></div>
  335.   <div class="shooting_star"></div>
  336.   <div class="shooting_star"></div>
  337.   <div class="shooting_star"></div>
  338.   <div class="shooting_star"></div>
  339.   <div class="shooting_star"></div>
  340.   <div class="shooting_star"></div>
  341.   <div class="shooting_star"></div>
  342.   <div class="shooting_star"></div>
  343.   <div class="shooting_star"></div>
  344.   <div class="shooting_star"></div>
  345.   <div class="shooting_star"></div>
  346.   <div class="shooting_star"></div>
  347.   <div class="shooting_star"></div>
  348.   <div class="shooting_star"></div>
  349.   <div class="shooting_star"></div>
  350.   <div class="shooting_star"></div>
  351.   <div class="shooting_star"></div>
  352.   <div class="shooting_star"></div>
  353.   <div class="shooting_star"></div>
  354. </div>
  355. </body>
  356. </html>
复制代码


2 个回复

倒序浏览
summer小小
金牌服务用户   /  发表于:2022-7-16 15:34:17
沙发
你好这个复制也不能用,希望能多更新一些动效元素,比如动态边框
回复 使用道具 举报
Eden.SunWyn认证
超级版主   /  发表于:2022-7-17 18:46:48
板凳
summer小小 发表于 2022-7-16 15:34
你好这个复制也不能用,希望能多更新一些动效元素,比如动态边框

您好,您可以在我们的葡萄城市场查找更多插件和动效哦:https://marketplace.grapecity.co ... tabName=Tabs_detail
在论坛这里的话,您可以直接复制代码(不要通过“复制代码”的按钮进行复制),就可以啦

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部