For Tailwind CSS v3 docs, click here.

Smooth Cursor

A customizable, physics-based smooth cursor animation component for Vue applications.

通过 CLI 安装

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

手动安装

复制并粘贴以下代码:

SmoothCursor.vue
DefaultCursor.vue

API

Prop 名称类型默认值描述
cursorComponentDefaultCursorCustom cursor component to replace the default cursor
springConfigSpringConfigSee belowConfiguration object for the spring animation behavior.

SpringConfig Type

interface springConfig {
  damping: number;
  stiffness: number;
  mass: number;
  restDelta: number;
}

Default SpringConfig Configuration

const defaultSpringConfig = {
  damping: 45,
  stiffness: 400,
  mass: 1,
  restDelta: 0.001,
};

Browser Support

Compatible with all modern browsers that support:

  • requestAnimationFrame
  • CSS transforms
  • Pointer events

Accessibility

When using this component, consider that:

  • Users navigating via keyboard will not see the custom cursor
  • You may want to provide alternative visual cues for interactive elements
  • Some users may have motion sensitivity, so consider providing a way to disable the animation

功能特性

  • 🎯 Smooth physics-based cursor animations
  • 🔄 Rotation effects based on movement direction
  • ⚡ Performance optimized with RAF
  • 🎨 Fully customizable cursor design
  • 📦 Lightweight and easy to implement

感谢