For Tailwind CSS v3 docs, click here.

宇宙环球

A breathtaking, animated 3D portal built with Three.js that features glowing rings, floating crystals, space distortion, and interdimensional streams.

API

Prop 名称类型默认值描述
portalComplexitynumber4Controls the complexity of the portal effects and geometry.
crystalCountnumber12Number of floating crystals in the scene.
primaryColorstring#9b59b6Main color for portal and background glow.
secondaryColorstring#3498dbSecondary color for blending and glow.
accentColorstring#e74c3cColor used for portal energy and highlight.
vortexColorstring#2ecc71Color used for swirling vortex and dimensional streams.
rotationSpeednumber0.3Speed at which objects rotate.
bloomStrengthnumber1.2Intensity of bloom postprocessing.
bloomRadiusnumber0.7Radius of the bloom effect.
bloomThresholdnumber0.2Threshold for bloom visibility.
dimensionShiftnumber4Level of dimension distortion for shader animation.

功能特性

  • Stunning Visuals: Animated cosmic background, glowing vortex rings, and interdimensional streams.
  • Shader Driven Effects: Unique portal burst, distortion, and pulsing animations.
  • User Controls: Zoom, rotate, and orbit around the scene using OrbitControls.
  • Postprocessing: Includes bloom and FXAA for cinematic quality.
  • Dynamic Colors: Easily shift dimensions and regenerate colors using exposed methods.
  • Exposed Actions: Call activatePortal() to trigger portal effects or shiftDimensions() to regenerate the visual style.

安装

确保在您的项目中安装了以下库:

npm
pnpm
bun
yarn
npm i three postprocessing
npm
pnpm
bun
yarn
npm i -D @types/three

通过 CLI 安装

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

手动安装

复制和粘贴下列代码:

CosmicPortal.vue

感谢