Fog.vue 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div class="fog-box">
  3. <div class="fog"></div>
  4. <svg width="0" height="0" >
  5. <filter id="steam">
  6. <feTurbulence type="fractalNoise" baseFrequency=".01" numOctaves="10" />
  7. <feDisplacementMap in="SourceGraphic" scale="180" />
  8. </filter>
  9. </svg>
  10. </div>
  11. </template>
  12. <style lang="less" scoped>
  13. @fog-color: #787F78;
  14. @fog-last-time: 20s;
  15. .fog-box {
  16. position: absolute;
  17. z-index: 20;
  18. width: 100%;
  19. height: 100%;
  20. overflow: hidden;
  21. // overflow-y: hidden;
  22. .fog{
  23. position: absolute;
  24. top: -400px;
  25. width: 100%;
  26. height: 100%;
  27. border-radius: 50%;
  28. box-shadow: -156px 492px 123px -252px @fog-color;
  29. filter: url(#steam);
  30. min-width: 600px;
  31. min-height: 600px;
  32. animation-name: fogAnimation;
  33. animation-duration: @fog-last-time;
  34. animation-direction: normal;
  35. animation-iteration-count: infinite;
  36. animation-timing-function: ease-in-out;
  37. will-change: transform, opacity;
  38. }
  39. @keyframes fogAnimation {
  40. 0%{
  41. transform: translate(-20%, -20%);
  42. opacity: 0;
  43. }
  44. 50% {
  45. opacity: 0.8;
  46. }
  47. 100%{
  48. transform: translate(60%, -40%);
  49. opacity: 0;
  50. }
  51. }
  52. }
  53. </style>