Sci-Fi Core Generator
Interactive WebGL
Chassis Material
Space Gray
Orbital Ring
Product Red
Energy Core
Blue
$4,999In Stock
Installation
You will need to install the Three.js ecosystem:
npm install three @react-three/fiber @react-three/drei
npx kinetic-ui-cli@latest add product-customizerUsage
import { ProductCustomizer } from "@/components/creative/product-customizer";
export default function Page() {
return (
<div className="w-full max-w-6xl mx-auto">
<ProductCustomizer />
</div>
);
}
How it works
This component merges standard React state (useState) with the React Three Fiber (useFrame) render loop to create a highly optimized interactive 3D experience.
- State Management: The UI sidebar uses standard React state to track the active hex colors for the
base,accent, andcorematerials. - Animation Loop: Instead of abruptly snapping to a new color when a user clicks a swatch, we pass the hex color down to an
AnimatedMaterialcomponent. Inside that component, auseFramehook continuously calls Three.js's native.lerp()function to smoothly blend the current material color into the target material color at 60fps. - Environment & Lighting: We use
@react-three/drei'sEnvironmentpreset ("city") to provide realistic HDRI lighting and reflections on the metallic surfaces. TheContactShadowscomponent renders a realistic, blurring shadow directly underneath the floating geometry.
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { ProductCustomizer } from "@/components/creative/product-customizer";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { ProductCustomizer } from "@/components/creative/product-customizer";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<ProductCustomizer
/>
</div>
);
}