index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <!--
  2. 描述: 闪动云
  3. 作者: Jack Chen
  4. 日期: 2020-05-02
  5. -->
  6. <template>
  7. <div class="wrap-container sn-container">
  8. <div class="sn-content">
  9. <div class="sn-title">闪动云</div>
  10. <div class="sn-body">
  11. <div class="wrap-container cloud">
  12. <div class="pd-main-left">
  13. <div class="yun-container">
  14. <div class="yun-tree"></div>
  15. <div class="line-fs"></div>
  16. <div class="line-fs"></div>
  17. <div class="line-fs"></div>
  18. <div class="line-fs"></div>
  19. <div class="line-fs"></div>
  20. <div class="line-fs"></div>
  21. <div class="line-fs"></div>
  22. <div class="line-fs"></div>
  23. <div class="line-fs"></div>
  24. </div>
  25. <div id="yunText" class="yun-text">
  26. <div
  27. :id="`yunText-${index + 1}`"
  28. :class="{ 'span-flash': number == index }"
  29. v-for="(item, index) in arrData"
  30. :key="index"
  31. >
  32. <span :title="item.title">{{ item.title }}</span>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. export default {
  43. name: `flashCloud`,
  44. data() {
  45. return {
  46. number: 0,
  47. arrData: [
  48. {
  49. title: `JavaScript`,
  50. },
  51. {
  52. title: `Vue.js`,
  53. },
  54. {
  55. title: `React.js`,
  56. },
  57. {
  58. title: `Node.js`,
  59. },
  60. {
  61. title: `Angular`,
  62. },
  63. {
  64. title: `HTML5`,
  65. },
  66. {
  67. title: `CSS3`,
  68. },
  69. {
  70. title: `jQuery`,
  71. },
  72. {
  73. title: `Typescript`,
  74. },
  75. {
  76. title: `Bootstrap`,
  77. },
  78. {
  79. title: `WebApp`,
  80. },
  81. {
  82. title: `小程序`,
  83. },
  84. {
  85. title: `HTTP`,
  86. },
  87. {
  88. title: `Sass/Less`,
  89. },
  90. {
  91. title: `Webpack`,
  92. },
  93. {
  94. title: `ES6`,
  95. },
  96. ],
  97. }
  98. },
  99. mounted() {
  100. let len = 5
  101. this.timer = setInterval(() => {
  102. this.number = parseInt(Math.random() * 15, 10)
  103. if (len == 0) {
  104. len = 5
  105. return this.arrData.sort(() => Math.random() - 0.5)
  106. } else {
  107. len--
  108. }
  109. }, 2000)
  110. },
  111. methods: {},
  112. beforeDestroy() {
  113. clearInterval(this.timer)
  114. },
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .sn-container {
  119. left: 512px;
  120. top: 1978px;
  121. width: 432px;
  122. height: 400px;
  123. .cloud {
  124. left: 55px;
  125. top: 0;
  126. width: 80%;
  127. height: 100%;
  128. }
  129. .pd-main-left {
  130. position: relative;
  131. width: 310px;
  132. height: 335px;
  133. .yun-container {
  134. width: 100%;
  135. height: 100%;
  136. > div {
  137. &:nth-child(2) {
  138. height: 90%;
  139. -webkit-animation-duration: 2s;
  140. -moz-animation-duration: 2s;
  141. -o-animation-duration: 2s;
  142. animation-duration: 2s;
  143. -webkit-animation-delay: 1.5s;
  144. -moz-animation-delay: 1.5s;
  145. -o-animation-delay: 1.5s;
  146. animation-delay: 1.5s;
  147. bottom: 0;
  148. left: 51px;
  149. }
  150. &:nth-child(3) {
  151. height: 100%;
  152. -webkit-animation-duration: 3s;
  153. -moz-animation-duration: 3s;
  154. -o-animation-duration: 3s;
  155. animation-duration: 3s;
  156. -webkit-animation-delay: 0s;
  157. -moz-animation-delay: 0s;
  158. -o-animation-delay: 0s;
  159. animation-delay: 0s;
  160. bottom: 32px;
  161. left: 89px;
  162. }
  163. &:nth-child(4) {
  164. height: 100%;
  165. -webkit-animation-duration: 2.5s;
  166. -moz-animation-duration: 2.5s;
  167. -o-animation-duration: 2.5s;
  168. animation-duration: 2.5s;
  169. -webkit-animation-delay: 1s;
  170. -moz-animation-delay: 1s;
  171. -o-animation-delay: 1s;
  172. animation-delay: 1s;
  173. bottom: 3px;
  174. left: 179px;
  175. -webkit-filter: hue-rotate(180deg);
  176. filter: hue-rotate(180deg);
  177. }
  178. &:nth-child(5) {
  179. height: 90%;
  180. -webkit-animation-duration: 2s;
  181. -moz-animation-duration: 2s;
  182. -o-animation-duration: 2s;
  183. animation-duration: 2s;
  184. -webkit-animation-delay: 2s;
  185. -moz-animation-delay: 2s;
  186. -o-animation-delay: 2s;
  187. animation-delay: 2s;
  188. bottom: 42px;
  189. left: 229px;
  190. }
  191. &:nth-child(6) {
  192. height: 100%;
  193. -webkit-animation-duration: 2.5s;
  194. -moz-animation-duration: 2.5s;
  195. -o-animation-duration: 2.5s;
  196. animation-duration: 2.5s;
  197. -webkit-animation-delay: 0.5s;
  198. -moz-animation-delay: 0.5s;
  199. -o-animation-delay: 0.5s;
  200. animation-delay: 0.5s;
  201. bottom: 11px;
  202. right: 48px;
  203. }
  204. &:nth-child(7) {
  205. height: 90%;
  206. -webkit-animation-duration: 3s;
  207. -moz-animation-duration: 3s;
  208. -o-animation-duration: 3s;
  209. animation-duration: 3s;
  210. -webkit-animation-delay: 2.5s;
  211. -moz-animation-delay: 2.5s;
  212. -o-animation-delay: 2.5s;
  213. animation-delay: 2.5s;
  214. bottom: -22px;
  215. right: 174px;
  216. -webkit-filter: hue-rotate(180deg);
  217. filter: hue-rotate(180deg);
  218. }
  219. &:nth-child(8) {
  220. height: 90%;
  221. -webkit-animation-duration: 3s;
  222. -moz-animation-duration: 3s;
  223. -o-animation-duration: 3s;
  224. animation-duration: 3s;
  225. -webkit-animation-delay: 1.5s;
  226. -moz-animation-delay: 1.5s;
  227. -o-animation-delay: 1.5s;
  228. animation-delay: 1.5s;
  229. bottom: -22px;
  230. right: 100px;
  231. }
  232. &:nth-child(9) {
  233. height: 100%;
  234. -webkit-animation-duration: 2.5s;
  235. -moz-animation-duration: 2.5s;
  236. -o-animation-duration: 2.5s;
  237. animation-duration: 2.5s;
  238. -webkit-animation-delay: 2s;
  239. -moz-animation-delay: 2s;
  240. -o-animation-delay: 2s;
  241. animation-delay: 2s;
  242. bottom: -10px;
  243. right: 220px;
  244. }
  245. &:nth-child(10) {
  246. height: 95%;
  247. -webkit-animation-duration: 2s;
  248. -moz-animation-duration: 2s;
  249. -o-animation-duration: 2s;
  250. animation-duration: 2s;
  251. -webkit-animation-delay: 1s;
  252. -moz-animation-delay: 1s;
  253. -o-animation-delay: 1s;
  254. animation-delay: 1s;
  255. bottom: -41px;
  256. right: 182px;
  257. }
  258. }
  259. background: url(../../assets/img/pd-main-left-bg-2.png) no-repeat 50% 50%;
  260. .yun-tree {
  261. width: 100%;
  262. height: 100%;
  263. background: url(../../assets/img/pd-main-left-bg-tree.png) no-repeat 50%
  264. bottom;
  265. mix-blend-mode: screen;
  266. }
  267. .line-fs {
  268. width: 14px;
  269. height: 100%;
  270. background-image: url(../../assets/img/line-fs.png);
  271. background-repeat: no-repeat;
  272. background-position: 50% 150%;
  273. position: absolute;
  274. z-index: -1;
  275. -webkit-animation: fs 3s cubic-bezier(1, 0, 0.6, 0.6) infinite;
  276. -moz-animation: fs 3s cubic-bezier(1, 0, 0.6, 0.6) infinite;
  277. -o-animation: fs 3s cubic-bezier(1, 0, 0.6, 0.6) infinite;
  278. animation: fs 3s cubic-bezier(1, 0, 0.6, 0.6) infinite;
  279. }
  280. }
  281. .yun-text {
  282. position: absolute;
  283. width: 318px;
  284. height: 195px;
  285. top: 0;
  286. left: 50%;
  287. margin-left: -161px;
  288. z-index: 2;
  289. .span-flash {
  290. color: #00f6ff;
  291. font-size: 12px;
  292. -webkit-animation-name: yun-flash;
  293. -moz-animation-name: yun-flash;
  294. -o-animation-name: yun-flash;
  295. animation-name: yun-flash;
  296. -webkit-animation-duration: 1s;
  297. -moz-animation-duration: 1s;
  298. -o-animation-duration: 1s;
  299. animation-duration: 1s;
  300. -webkit-animation-iteration-count: 1;
  301. -moz-animation-iteration-count: 1;
  302. -o-animation-iteration-count: 1;
  303. animation-iteration-count: 1;
  304. }
  305. div {
  306. position: absolute;
  307. white-space: nowrap;
  308. overflow: hidden;
  309. -o-text-overflow: ellipsis;
  310. text-overflow: ellipsis;
  311. width: 70px;
  312. height: 36px;
  313. line-height: 36px;
  314. word-wrap: break-word;
  315. word-break: break-all;
  316. opacity: 0.8;
  317. color: #00f6ff;
  318. span {
  319. font-size: 12px;
  320. cursor: pointer;
  321. }
  322. &:nth-child(1) {
  323. top: 84px;
  324. left: 26px;
  325. }
  326. &:nth-child(2) {
  327. top: 13px;
  328. left: 157px;
  329. }
  330. &:nth-child(3) {
  331. top: 105px;
  332. left: 35px;
  333. }
  334. &:nth-child(4) {
  335. top: 38px;
  336. left: 89px;
  337. }
  338. &:nth-child(5) {
  339. top: 43px;
  340. left: 178px;
  341. }
  342. &:nth-child(6) {
  343. top: 76px;
  344. left: 227px;
  345. }
  346. &:nth-child(7) {
  347. top: 63px;
  348. left: 66px;
  349. }
  350. &:nth-child(8) {
  351. top: 156px;
  352. left: 43px;
  353. }
  354. &:nth-child(9) {
  355. top: 130px;
  356. left: 16px;
  357. }
  358. &:nth-child(10) {
  359. top: 93px;
  360. left: 128px;
  361. }
  362. &:nth-child(11) {
  363. top: 106px;
  364. left: 241px;
  365. }
  366. &:nth-child(12) {
  367. top: 121px;
  368. left: 112px;
  369. }
  370. &:nth-child(13) {
  371. top: 67px;
  372. left: 153px;
  373. }
  374. &:nth-child(14) {
  375. top: 157px;
  376. left: 207px;
  377. }
  378. &:nth-child(15) {
  379. top: 132px;
  380. left: 206px;
  381. }
  382. &:nth-child(16) {
  383. top: 150px;
  384. left: 117px;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. @-webkit-keyframes fs {
  391. 0% {
  392. background-position: 50% 150%;
  393. }
  394. 50% {
  395. background-position: 50% -132%;
  396. }
  397. 100% {
  398. background-position: 50% -264%;
  399. opacity: 0;
  400. }
  401. }
  402. @-moz-keyframes fs {
  403. 0% {
  404. background-position: 50% 150%;
  405. }
  406. 50% {
  407. background-position: 50% -132%;
  408. }
  409. 100% {
  410. background-position: 50% -264%;
  411. opacity: 0;
  412. }
  413. }
  414. @-o-keyframes fs {
  415. 0% {
  416. background-position: 50% 150%;
  417. }
  418. 50% {
  419. background-position: 50% -132%;
  420. }
  421. 100% {
  422. background-position: 50% -264%;
  423. opacity: 0;
  424. }
  425. }
  426. @keyframes fs {
  427. 0% {
  428. background-position: 50% 150%;
  429. }
  430. 50% {
  431. background-position: 50% -132%;
  432. }
  433. 100% {
  434. background-position: 50% -264%;
  435. opacity: 0;
  436. }
  437. }
  438. @-webkit-keyframes yun-flash {
  439. from,
  440. 50%,
  441. to {
  442. opacity: 1;
  443. }
  444. 25%,
  445. 75% {
  446. opacity: 0;
  447. }
  448. }
  449. @-moz-keyframes yun-flash {
  450. from,
  451. 50%,
  452. to {
  453. opacity: 1;
  454. }
  455. 25%,
  456. 75% {
  457. opacity: 0;
  458. }
  459. }
  460. @-o-keyframes yun-flash {
  461. from,
  462. 50%,
  463. to {
  464. opacity: 1;
  465. }
  466. 25%,
  467. 75% {
  468. opacity: 0;
  469. }
  470. }
  471. @keyframes yun-flash {
  472. from,
  473. 50%,
  474. to {
  475. opacity: 1;
  476. }
  477. 25%,
  478. 75% {
  479. opacity: 0;
  480. }
  481. }
  482. </style>