3D Globe
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
A textured three.js Earth turns slowly with avatar markers pinned to cities; drag to spin it.
Code
"use client";
import { Globe3D, GlobeMarker } from "@/lab/aceternity/ui/3d-globe";
const sampleMarkers: GlobeMarker[] = [
{
lat: 40.7128,
lng: -74.006,
src: "https://assets.aceternity.com/avatars/1.webp",
label: "New York",
},
{
lat: 51.5074,
lng: -0.1278,
src: "https://assets.aceternity.com/avatars/2.webp",
label: "London",
},
{
lat: 35.6762,
lng: 139.6503,
src: "https://assets.aceternity.com/avatars/3.webp",
label: "Tokyo",
},
{
lat: -33.8688,
lng: 151.2093,
src: "https://assets.aceternity.com/avatars/4.webp",
label: "Sydney",
},
{
lat: 48.8566,
lng: 2.3522,
src: "https://assets.aceternity.com/avatars/5.webp",
label: "Paris",
},
{
lat: 28.6139,
lng: 77.209,
src: "https://assets.aceternity.com/avatars/6.webp",
label: "New Delhi",
},
{
lat: 55.7558,
lng: 37.6173,
src: "https://assets.aceternity.com/avatars/7.webp",
label: "Moscow",
},
{
lat: -22.9068,
lng: -43.1729,
src: "https://assets.aceternity.com/avatars/8.webp",
label: "Rio de Janeiro",
},
{
lat: 31.2304,
lng: 121.4737,
src: "https://assets.aceternity.com/avatars/9.webp",
label: "Shanghai",
},
{
lat: 25.2048,
lng: 55.2708,
src: "https://assets.aceternity.com/avatars/10.webp",
label: "Dubai",
},
{
lat: -34.6037,
lng: -58.3816,
src: "https://assets.aceternity.com/avatars/11.webp",
label: "Buenos Aires",
},
{
lat: 1.3521,
lng: 103.8198,
src: "https://assets.aceternity.com/avatars/12.webp",
label: "Singapore",
},
{
lat: 37.5665,
lng: 126.978,
src: "https://assets.aceternity.com/avatars/13.webp",
label: "Seoul",
},
];
export default function Globe3DDemo() {
return (
<div className="relative h-full w-full">
<Globe3D
className="h-full"
markers={sampleMarkers}
config={{
atmosphereColor: "#4da6ff",
atmosphereIntensity: 20,
bumpScale: 5,
autoRotateSpeed: 0.3,
}}
/>
</div>
);
}
Prompt
Build "3D Globe", a 3d animation. What it does: A textured three.js Earth turns slowly with avatar markers pinned to cities; drag to spin it. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using @react-three/drei, @react-three/fiber, three. Technique: WebGL. It sits on a dark background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/3d-globe (Aceternity UI, Aceternity UI licence (free component)).