SVG Mask

A dynamic SVG mask component that reveals content with hover and mouse movement.

API

Prop NameTypeDefaultDescription
classstring""Additional CSS classes for custom styling.
sizenumber10Initial size of the mask in pixels.
revealSizenumber600Size of the mask during hover in pixels.

Component Code

You can copy and paste the following code to create this component:

SVGMask.vue
mask.svg

Features

  • Hover-Activated Mask: The SVG mask dynamically enlarges when hovered, revealing the content beneath.
  • Mouse Tracking: The mask follows the cursor, creating an engaging and interactive effect.
  • Customizable Mask Size: Adjust the initial size (size) and hover size (revealSize) for different effects.
  • Slot-Based Content: Supports named slots for base and reveal content, making it flexible for various use cases.
  • Responsive Background: Includes hover-based background color transitions for added visual appeal.

Credits