VisionOS
Spatial Computing
Immersive Interfaces
Hover over this card to interact with the 3D depth, specular highlights, and magnetic buttons.
Installation
npx kinetic-ui-cli@latest add spatial-uiUsage
import { SpatialCard, SpatialButton } from "@/components/creative/spatial-ui";
export default function Page() {
return (
<SpatialCard className="w-96 h-64">
<div className="flex flex-col h-full items-center justify-center gap-6">
<h2 className="text-2xl text-white font-light">Spatial Computing</h2>
<SpatialButton onClick={() => alert("Clicked!")}>
Enter Environment
</SpatialButton>
</div>
</SpatialCard>
);
}
How it works
This component heavily leverages Framer Motion's useMotionValue and useSpring to map your cursor position to a 3D coordinate space.
- Perspective & Depth: The parent container uses
perspective: 2000px, and the inner content wrapper usestranslateZto physically push the content outward towards the user. - Specular Highlights: A dynamic CSS
radial-gradientfollows your mouse cursor across the card, simulating real-world light reflecting off a glass surface. - Magnetic Buttons: The
SpatialButtoncomponents actually move theirxandycoordinates slightly towards your cursor, mimicking the "magnetic snap" effect seen in VisionOS when you look at a button.
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { SpatialUi } from "@/components/creative/spatial-ui";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { SpatialUi } from "@/components/creative/spatial-ui";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<SpatialUi
>
<div>Content goes here</div>
</SpatialUi>
</div>
);
}