Pattern.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div class="pointer-events-none">
  3. <div class="absolute inset-0 rounded-2xl transition duration-300 [mask-image:linear-gradient(white,transparent)] group-hover:opacity-50">
  4. <GridPattern
  5. :width="72"
  6. :height="56"
  7. :x="'50%'"
  8. :y="pattern.y"
  9. :squares="pattern.squares"
  10. class="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-white/1 stroke-white/2.5"/>
  11. </div>
  12. <div class="absolute inset-0 rounded-2xl bg-gradient-to-r opacity-0 transition duration-300 group-hover:opacity-100 from-[#202D2E] to-[#303428]"
  13. :style="{
  14. 'mask-image': maskImage
  15. }"></div>
  16. <div class="absolute inset-0 rounded-2xl opacity-0 mix-blend-overlay transition duration-300 group-hover:opacity-100"
  17. :style="{
  18. 'mask-image': maskImage
  19. }">
  20. <GridPattern
  21. :width="72"
  22. :height="56"
  23. :x="'50%'"
  24. :y="pattern.y"
  25. :squares="pattern.squares"
  26. class="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-white/2.5 stroke-white/10"/>
  27. </div>
  28. </div>
  29. </template>
  30. <script setup>
  31. const props = defineProps(['mouseX', 'mouseY', 'pattern']);
  32. const maskImage = computed(() => {
  33. return 'radial-gradient(180px at '+props.mouseX+'px '+props.mouseY+'px, white, transparent)';
  34. })
  35. </script>