Halo
threecn/haloFreeComponent
A glowing energy core wrapped by tilted orbit rings carrying satellites.
Install it
npx shadcn@latest add https://threecn.dev/r/halo.jsonSource
1"use client"23import * as React from "react"4import { useFrame } from "@react-three/fiber"5import * as THREE from "three"67import {8 SceneContainer,9 type SceneContainerProps,10} from "@/components/threecn/scene-container"11import {12 useShadcnTheme,13 type ThemeMode,14} from "@/components/hooks/use-shadcn-theme"1516function Ring({17 radius,18 tilt,19 speed,20 color,21 satellite,22}: {23 radius: number24 tilt: [number, number, number]25 speed: number26 color: THREE.Color27 satellite: THREE.Color28}) {29 const groupRef = React.useRef<THREE.Group>(null)30 useFrame((_, delta) => {31 if (groupRef.current) groupRef.current.rotation.z += delta * speed32 })33 return (34 <group rotation={tilt}>35 <group ref={groupRef}>36 <mesh>37 <torusGeometry args={[radius, 0.012, 12, 160]} />38 <meshBasicMaterial color={color} transparent opacity={0.55} />39 </mesh>40 {/* orbiting satellite */}41 <mesh position={[radius, 0, 0]}>42 <sphereGeometry args={[0.07, 16, 16]} />43 <meshStandardMaterial44 color={satellite}45 emissive={satellite}46 emissiveIntensity={1.2}47 toneMapped={false}48 />49 </mesh>50 </group>51 </group>52 )53}5455function HaloCore({56 rings,57 speed,58 glow,59 theme,60}: {61 rings: number62 speed: number63 glow: number64 theme: ThemeMode65}) {66 const { primaryColor, accentColor, mutedColor, foregroundColor } =67 useShadcnTheme(theme)68 const palette = [primaryColor, accentColor, mutedColor]6970 const config = React.useMemo(71 () =>72 Array.from({ length: rings }, (_, i) => ({73 radius: 1.5 + i * 0.55,74 tilt: [75 Math.PI / 2 + (i - rings / 2) * 0.5,76 i * 0.7,77 i * 0.4,78 ] as [number, number, number],79 speed: (0.5 + i * 0.25) * (i % 2 ? -1 : 1),80 colorKey: i % 3,81 })),82 [rings]83 )8485 return (86 <group>87 {/* glowing core */}88 <mesh>89 <sphereGeometry args={[0.65, 48, 48]} />90 <meshStandardMaterial91 color={foregroundColor}92 emissive={primaryColor}93 emissiveIntensity={glow}94 toneMapped={false}95 />96 </mesh>97 <mesh scale={1.3}>98 <sphereGeometry args={[0.65, 32, 32]} />99 <meshBasicMaterial color={primaryColor} transparent opacity={0.08} />100 </mesh>101 {config.map((r, i) => (102 <Ring103 key={i}104 radius={r.radius}105 tilt={r.tilt}106// … truncated
What it pulls in
npm packages
Files it writes
More from threecn
All 28 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AuroraRibbonsaurora-ribbons | threecn | Components | Free | 3 deps · 3 files | |
| Boidsboids | threecn | Components | Free | 3 deps · 3 files | |
| Clothcloth | threecn | Components | Free | 3 deps · 3 files | |
| Crystalcrystal | threecn | Components | Free | 3 deps · 3 files | |
| CubeWavecube-wave | threecn | Components | Free | 3 deps · 3 files | |
| CurlFlowcurl-flow | threecn | Components | Free | 3 deps · 3 files | |
| DnaHelixdna-helix | threecn | Components | Free | 3 deps · 3 files | |
| FloatingCard3Dfloating-card-3d | threecn | Components | Free | 3 deps · 3 files |
