For Tailwind CSS v3 docs, click here.

光效

A dynamic proximity-based glow effect that reacts to mouse movements and scroll events, perfect for highlighting interactive elements.

API

Prop 名称类型默认值描述
blurnumber0The blur radius applied to the glow layer.
inactiveZonenumber0.7Defines the inner radius (as a fraction of the smallest dimension) within which the glow is inactive.
proximitynumber0Additional proximity distance (in pixels) to trigger the glow when the cursor is near the element.
spreadnumber20Size of the spread of the glow effect around the element.
variant"default" | "white""default"Variant of the glow style (e.g., a white-themed version).
glowbooleanfalseControls the visibility of the static glow border.
classstring""Additional CSS classes for custom styling.
disabledbooleantrueDisables the proximity detection and glow animations when true.
movementDurationnumber2Duration (in seconds) of the smooth rotation animation.
borderWidthnumber1Width (in pixels) of the border applied to the glow effect.

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/glowing-effect.json"

手动安装

You can 复制并粘贴以下代码: to create this component:

GlowingEffect.vue

功能特性

  • Proximity-Based Activation: The glow effect is only active when the cursor is within a certain distance of the element.
  • Smooth Angle Animation: Gradually animates rotation based on pointer movement for an appealing dynamic glow.
  • Configurable Glow Properties: Fine-tune blur, spread, and proximity to achieve various visual effects.
  • Variant Support: Choose between default or white glow styling.
  • Performance Optimizations: Event listeners and animation frames are managed efficiently.

感谢