For Tailwind CSS v3 docs, click here.

Particle Image

Visually appealing particle animation applied to images as seen on NuxtLabs.com

通过 CLI 安装

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

手动安装

在同一个文件中,复制并粘贴以下代码:

ParticleImage.vue
inspiraImageParticles.js
inspiraImageParticles.d.ts

API

Prop 名称类型默认值描述
imageSrcstringnullSource URL for the image to which the particle effect is applied.
classstringnullAdditional CSS classes to apply to the image element.
canvasWidthstringnullWidth of the particle effect canvas.
canvasHeightstringnullHeight of the particle effect canvas.
gravitystringnullGravity force affecting the particle movement.
particleSizestringnullSize of the particles.
particleGapstringnullGap between particles.
mouseForcestringnullForce applied to particles based on mouse movement.
renderer"default" | "webgl"nullThe renderer to use for particle generation, either default or WebGL.
colorstring#FFFHexadecimal color code used for particles. Supports 3 or 6 character hex codes.
colorArrnumber[]nullArray of numbers to define multiple particle colors.
initPosition"random" | "top" | "left" | "bottom" | "right" | "misplaced" | "none"randomInitial position of the particles when the animation starts.
initDirection"random" | "top" | "left" | "bottom" | "right" | "none"randomInitial direction of the particles when the animation starts.
fadePosition"explode" | "top" | "left" | "bottom" | "right" | "random" | "none"nonePosition where the particles fade out.
fadeDirection"random" | "top" | "left" | "bottom" | "right" | "none"noneDirection in which the particles fade out.
noisenumbernullNoise of the particles.
responsiveWidthbooleanfalseShould the canvas be responsive.

感谢