VciEffectShadowTracing.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div
  3. :style="{ transformStyle, perspective }"
  4. class="VciEffectShadowTracing"
  5. >
  6. <i
  7. v-for="(v, i) in Number(amount)"
  8. :key="i"
  9. :class="mode"
  10. :style="genEstSyl(i)"
  11. class="est est-amt"
  12. ></i>
  13. <div
  14. :style="{ zIndex: amount + 1 }"
  15. class="est-view"
  16. >
  17. <slot></slot>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. // power by visual-ceiling, at 2023/6/12 16:10
  23. export default {
  24. name: "VciEffectShadowTracing",
  25. props: {
  26. urlGraphic: {
  27. type: String,
  28. default: null
  29. },
  30. amount: {
  31. type: [Number, String],
  32. default: 4
  33. },
  34. mode: {
  35. type: String,
  36. default: "vci-bg-fill"
  37. },
  38. fixFirstEst: {
  39. type: Boolean,
  40. default: false
  41. },
  42. delayDurationStep: {
  43. type: [Number, String],
  44. default: 600
  45. },
  46. enableAlphaTracing: {
  47. type: Boolean,
  48. default: false
  49. },
  50. zIndexEst: {
  51. type: Number,
  52. default: 3
  53. },
  54. transformStyle: {
  55. type: String,
  56. default: "preserve-3d"
  57. },
  58. perspective: {
  59. type: String,
  60. default: "1000px"
  61. }
  62. },
  63. data() {
  64. return {};
  65. },
  66. methods: {
  67. genEstSyl(index = 0) {
  68. return {
  69. animationDelay: `${(this.fixFirstEst ? (index - 1) : index) * Number(this.delayDurationStep)}ms`,
  70. animationName: this.fixFirstEst && index === 0 ? "none" : null,
  71. opacity: this.enableAlphaTracing ? 1 - index / Number(this.amount) : 1,
  72. zIndex: this.zIndexEst
  73. };
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss" scoped>
  79. .VciEffectShadowTracing {
  80. position: relative;
  81. width: 100%;
  82. height: 100%;
  83. .est {
  84. position: absolute;
  85. left: 0;
  86. top: 0;
  87. width: 100%;
  88. height: 100%;
  89. &.est-amt {
  90. animation: amtEst 1.8s infinite both linear;
  91. @keyframes amtEst {
  92. from {
  93. opacity: 0;
  94. transform: scale(1);
  95. }
  96. 50% {
  97. opacity: 0.5;
  98. transform: scale(1.3);
  99. }
  100. to {
  101. opacity: 0;
  102. transform: scale(1.6);
  103. }
  104. }
  105. }
  106. }
  107. .est-view {
  108. position: relative;
  109. z-index: 2;
  110. width: 100%;
  111. height: 100%;
  112. }
  113. }
  114. </style>