index.vue 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div class="fireflies-box">
  3. <div class="fireflies">
  4. <div class="firefly fly1"></div>
  5. <div class="firefly fly2"></div>
  6. <div class="firefly fly3"></div>
  7. <div class="firefly fly4"></div>
  8. <div class="firefly fly5"></div>
  9. <div class="firefly fly6"></div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. name: 'FireFlies'
  16. }
  17. </script>
  18. <style lang="less" scoped>
  19. .fireflies-box {
  20. width: 100%;
  21. height: 100%;
  22. background: transparent;
  23. position: absolute;
  24. top: 0;
  25. left: 0;
  26. .fireflies {
  27. position: relative;
  28. width: 100%;
  29. height: 100%;
  30. .firefly {
  31. position:absolute;
  32. top:50%;
  33. left:50%;
  34. width: 0.3em;
  35. height: 0.3em;
  36. background-color:rgb(244,219,98);
  37. border-radius:50%;
  38. box-shadow:0 0 1.4em rgb(244,219,98);
  39. opacity: 0;
  40. }
  41. @tm-dur: 3s;
  42. @tm-dly: .3s;
  43. .fly1 {
  44. animation-delay: @tm-dly;
  45. animation-name: shake, flight1;
  46. animation-duration: @tm-dur - .6;
  47. animation-iteration-count: infinite;
  48. animation-timing-function: linear;
  49. }
  50. .fly2 {
  51. animation-delay: @tm-dly;
  52. animation-name: shake, flight2;
  53. animation-duration: @tm-dur + .5;
  54. animation-iteration-count: infinite;
  55. animation-timing-function: linear;
  56. }
  57. .fly3 {
  58. animation-delay: @tm-dly;
  59. animation-name: shake, flight3;
  60. animation-duration: @tm-dur + .8;
  61. animation-iteration-count: infinite;
  62. animation-timing-function: linear;
  63. }
  64. .fly4 {
  65. animation-delay: @tm-dly;
  66. animation-name: shake, flight4;
  67. animation-duration: @tm-dur + .5;
  68. animation-iteration-count: infinite;
  69. animation-timing-function: linear;
  70. }
  71. .fly5 {
  72. animation-delay: @tm-dly;
  73. animation-name: shake, flight5;
  74. animation-duration: @tm-dur + .2;
  75. animation-iteration-count: infinite;
  76. animation-timing-function: linear;
  77. }
  78. .fly6 {
  79. animation-delay: @tm-dly;
  80. animation-name: shake, flight6;
  81. animation-duration: @tm-dur - .3;
  82. animation-iteration-count: infinite;
  83. animation-timing-function: linear;
  84. }
  85. }
  86. @keyframes shake {
  87. 0% {
  88. opacity: 0.1;
  89. }
  90. 85% {
  91. opacity: 1;
  92. width: 0.6em;
  93. height: 0.6em;
  94. }
  95. 100% {
  96. opacity: 0;
  97. }
  98. }
  99. @keyframes flight1 {
  100. 0% {
  101. top: 50%;
  102. left: 50%;
  103. }
  104. 60% {
  105. top: 35%;
  106. left: 16%;
  107. }
  108. 100% {
  109. top:15%;
  110. left:5%;
  111. }
  112. }
  113. @keyframes flight2 {
  114. 0% {
  115. top: 50%;
  116. left: 50%;
  117. }
  118. 60% {
  119. top: 45%;
  120. left: 15%;
  121. }
  122. 100% {
  123. top: 55%;
  124. left:3%;
  125. }
  126. }
  127. @keyframes flight3 {
  128. 0% {
  129. top: 50%;
  130. left: 50%;
  131. }
  132. 50% {
  133. top: 65%;
  134. left: 25%;
  135. }
  136. 100% {
  137. top: 85%;
  138. left:8%;
  139. }
  140. }
  141. @keyframes flight4 {
  142. 0% {
  143. top: 50%;
  144. left: 50%;
  145. }
  146. 60% {
  147. top: 35%;
  148. left: 76%;
  149. }
  150. 100% {
  151. top: 15%;
  152. left: 95%;
  153. }
  154. }
  155. @keyframes flight5 {
  156. 0% {
  157. top: 50%;
  158. left: 50%;
  159. }
  160. 60% {
  161. top: 52%;
  162. left: 80%;
  163. }
  164. 100% {
  165. top: 55%;
  166. left: 95%;
  167. }
  168. }
  169. @keyframes flight6 {
  170. 0% {
  171. top: 50%;
  172. left: 50%;
  173. }
  174. 50% {
  175. top: 65%;
  176. left: 75%;
  177. }
  178. 100% {
  179. top: 85%;
  180. left: 88%;
  181. }
  182. }
  183. }
  184. </style>