Baktiyar Ablaikhan

Globe

Source
Magic UI ↗
Author
Magic UI
Licence
MIT

Loading…

A dotted WebGL globe (cobe) spins slowly; drag it to turn it.

Code

"use client";

import { Globe } from "@/lab/magicui/ui/globe";

export default function GlobeDemo() {
  return (
    <div className="@container relative flex h-full w-full items-start justify-center overflow-hidden pt-[6%]">
      <span className="pointer-events-none bg-linear-to-b from-black to-gray-300/80 bg-clip-text text-center text-[clamp(3rem,12cqw,6rem)] leading-none font-semibold whitespace-pre-wrap text-transparent">
        Globe
      </span>
      <Globe className="inset-auto top-[28%] left-1/2 w-[min(80%,600px)] -translate-x-1/2" />
      <div className="pointer-events-none absolute inset-0 h-full bg-[radial-gradient(circle_at_50%_200%,rgba(0,0,0,0.2),rgba(255,255,255,0))]" />
    </div>
  );
}
Prompt

Build "Globe", a 3d animation. What it does: A dotted WebGL globe (cobe) spins slowly; drag it to turn 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 cobe, motion. Technique: an HTML canvas, WebGL, a requestAnimationFrame loop, the Motion library, pointer tracking. It sits on a light 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://magicui.design/docs/components/globe (Magic UI, MIT).