Dotted GlobeNo account needed

A slowly rotating 3D globe made of dots, drawn on a canvas with no dependencies.

Add to your project

Let your AI assistant add it

Paste this into your AI coding tool to add the component.

# Integrate this UI component

Add this component to my project.

1. Install any missing dependencies.
2. Make sure Tailwind CSS is set up and scans the new file.
3. Prefer passing props over editing the component source — changing the component itself may break it.
4. Adjust colors, size, and layout via props or wrapper classes to match my project. You know my codebase better than this snippet does.

## Component source

```tsx
'use client';

import { useEffect, useRef } from 'react';

type DottedGlobeProps = {
  className?: string;
};

// 720x360 land mask (0.5 degree per cell, north to south). Each row is
// alternating run lengths in base 36, starting with water.
const LAND_MASK = 'k0;k0;k0;k0;k0;k0;k0;k0;k0;k0;k0;k0;k0;7m,1,3,3,3,m,bi;5k,x,y,1d,b8;59,4,2,16,c,3,2,1,4,5,4,2,1,12,bf;4z,1g,7,21,2,5,a,5,ar;4t,2,6,1c,8,28,1,h,3v,2,23,1,4o;4p,9,5,3,1,e,1,l,6,2u,3k,3,7,5,5,5,2,3,1l,8,4m;4o,e,1,2,2,5,3,o,7,2n,1,5,20,3,3,2,1,3,18,3,e,4,1w,b,4l;4o,i,1,u,d,2j,2,1,1m,3,4,1,2,3,3,f,3n,3,1,c,4g;45,5,k,f,2,h,1,1,j,2k,1p,9,1,6,8,2,3x,a,4,3,4a;48,8,4,2,7,c,1,o,a,2q,1u,i,4f,9,46;3s,1,1,3,g,4,3,6,6,3,6,o,6,2u,1x,2,3,7,3,4,4a,7,4a;3n,1,2,6,s,5,b,4,1,f,f,2s,1x,9,6,5,8o;3d,7,l,2,s,1,5,g,l,2r,1,1,1u,6,4o,8,45;3b,9,d,2,o,6,8,n,h,2o,5,1,1x,2,2q,6,1s,c,42;37,7,2,1,3,4,1,1,6,3,8,4,1,2,2,5,9,6,i,2,m,9,1,1,2,2c,3,1,4f,2,2,a,1q,r,3r;3e,2,3,a,5,7,5,b,5,1,5,5,b,5,19,27,4c,c,1k,16,1c,6,1,3,1,3,1z;3h,6,1,g,3,1,7,5,3,6,2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,b,41,1c,1r,2,3;63,1q,2v,1e,e,b,41,1c,1w;63,1q,2w,1c,f,a,41,1e,1v;63,1q,2w,1a,i,9,41,1f,1u;64,1o,2y,18,j,9,3z,1j,1s;64,1o,2y,17,k,8,3w,1o,1r;64,1n,30,17,i,9,3s,1t,v,1,u;64,1m,31,17,h,a,3q,1v,w,1,t;64,1m,32,17,g,9,3q,1x,w,2,r;64,1l,34,16,g,9,3p,1y,y,1,q;63,1l,35,16,g,9,3n,23,1m;63,1g,3a,16,g,8,3p,22,1m;63,1e,3c,16,g,8,3o,23,1m;63,1b,3f,16,g,8,3o,25,1k;63,1a,3g,15,i,6,3p,26,1j;63,19,3i,11,m,3,3s,25,1j;63,18,3j,10,4i,26,1i;63,18,3j,10,4i,26,1i;62,19,3j,10,4h,27,1i;62,19,3k,z,4i,26,1i;62,19,3k,y,4j,27,1h;62,19,3l,x,4k,26,1h;61,19,3n,v,4l,26,1h;61,18,3p,t,4n,25,1h;61,17,3q,s,4o,25,1h;61,17,3r,r,4o,24,1i;61,14,3u,q,4p,24,1i;61,14,3v,o,4r,23,1i;61,13,3w,n,4s,r,6,16,1i;61,13,3x,l,4t,o,c,12,1j;61,12,3x,l,4u,j,i,10,1k;61,11,3y,j,4w,h,l,6,1,r,1l;60,11,40,f,4y,h,n,4,2,r,1l;60,r,1,9,41,6,56,9,w,2,2,r,1m;60,s,3,4,44,1,5c,5,y,1,3,1,1,p,1m;5z,u,aw,o,19,2,c;5z,u,at,1,3,n,1a,2,b;5y,w,ax,l,1c,1,b;5y,x,ax,k,1d,1,a;5x,x,ay,k,1d,3,8;5x,w,b0,i,1f,3,2,2,3;5x,v,b3,6,1,5,1i,8,3;5x,s,bf,1,1k,7,4;5x,n,d4,6,6;5x,n,d5,5,6;5x,m,d7,3,7;5w,n,d2,1,4,3,7;5w,i,bn,8,1b,4,2,2,8;5w,1,2,f,bo,7,1a,5,c;5w,1,2,g,1,1,bm,5,1b,5,c;5w,1,1,g,2,1,bm,5,1a,5,d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u,2f,ax,6,1,q;17,h,1,49,25,b1,5,1,q;1d,40,1,9,1m,b,g,b5,1,1,t;y,1,d,41,5,5,i,4,y,d,g,az,1,3,x;w,7,h,3x,k,4,3,1,y,f,p,am,13;11,4,m,40,j,2,u,g,z,ab,14;1n,45,t,4,c,i,t,aj,15;1q,43,7,3,f,6,c,9,s,aw,13;1c,4y,1g,b7,13;1f,4z,19,be,z;1h,4w,m,h,5,bh,y;1f,54,b,cf,r;i,b,g,5c,5,cn,n;o,iz,d;w,j3,1;0,o,i,iu;0,k0;0,k0;0,k0;0,k0;0,k0;0,k0;0,k0;0,k0;0,k0;0,k0';

const TILT = (23 * Math.PI) / 180; // axial tilt toward the viewer
const START = (-23 * Math.PI) / 180; // starting longitude
const SPIN = 0.12; // radians per second
const DOT_STEP = 1.2; // degrees between dots

// Decode the mask once and turn every land cell on the dot grid into a unit vector.
function buildDots() {
  const land = new Uint8Array(720 * 360);
  LAND_MASK.split(';').forEach((row, y) => {
    let x = 0;
    row.split(',').forEach((run, i) => {
      const length = parseInt(run, 36);
      if (i % 2) land.fill(1, y * 720 + x, y * 720 + x + length);
      x += length;
    });
  });

  const dots: number[] = [];
  for (let lat = -90; lat <= 90; lat += DOT_STEP) {
    const latRad = (lat * Math.PI) / 180;
    const cos = Math.cos(latRad);
    const lngStep = DOT_STEP / Math.max(cos, 0.05);
    for (let lng = -180; lng < 180; lng += lngStep) {
      const row = Math.min(359, Math.floor((90 - lat) * 2));
      const col = Math.min(719, Math.floor((lng + 180) * 2));
      if (!land[row * 720 + col]) continue;
      const lngRad = (lng * Math.PI) / 180;
      dots.push(cos * Math.sin(lngRad), Math.sin(latRad), cos * Math.cos(lngRad));
    }
  }
  return new Float32Array(dots);
}

export default function DottedGlobe({ className = '' }: DottedGlobeProps) {
  const canvasRef = useRef<HTMLCanvasElement>(null);

  useEffect(() => {
    const canvas = canvasRef.current;
    const ctx = canvas?.getContext('2d');
    if (!canvas || !ctx) return;

    const dots = buildDots();
    const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
    let angle = START;
    let visible = true;
    let frame = 0;
    let last = 0;

    const draw = () => {
      const { width, height } = canvas;
      const radius = (Math.min(width, height) / 2) * 0.995;
      const cx = width / 2;
      const cy = height / 2;
      const sinA = Math.sin(angle);
      const cosA = Math.cos(angle);
      const sinT = Math.sin(TILT);
      const cosT = Math.cos(TILT);

      ctx.clearRect(0, 0, width, height);
      // Read the token color each frame so theme changes apply immediately.
      ctx.fillStyle = getComputedStyle(canvas).color;
      ctx.beginPath();
      for (let i = 0; i < dots.length; i += 3) {
        const x = dots[i] * cosA + dots[i + 2] * sinA;
        const z1 = -dots[i] * sinA + dots[i + 2] * cosA;
        const y = dots[i + 1] * cosT - z1 * sinT;
        const z = dots[i + 1] * sinT + z1 * cosT;
        if (z <= 0) continue;
        const r = radius * 0.0065 * (0.5 + 0.5 * z); // dots shrink toward the edge
        const px = cx + x * radius;
        const py = cy - y * radius;
        ctx.moveTo(px + r, py);
        ctx.arc(px, py, r, 0, Math.PI * 2);
      }
      ctx.fill();
    };

    const tick = (now: number) => {
      angle += ((now - last) / 1000) * SPIN;
      last = now;
      draw();
      frame = requestAnimationFrame(tick);
    };

    const stop = () => cancelAnimationFrame(frame);
    const sync = () => {
      stop();
      if (reducedMotion.matches || !visible || document.hidden) return draw();
      last = performance.now();
      frame = requestAnimationFrame(tick);
    };

    const resize = () => {
      const dpr = Math.min(window.devicePixelRatio || 1, 2);
      canvas.width = Math.round(canvas.clientWidth * dpr);
      canvas.height = Math.round(canvas.clientHeight * dpr);
      draw();
    };

    const resizeObserver = new ResizeObserver(resize);
    resizeObserver.observe(canvas);
    const visibilityObserver = new IntersectionObserver(([entry]) => {
      visible = entry.isIntersecting;
      sync();
    });
    visibilityObserver.observe(canvas);
    // Redraw when the theme class or attribute changes, even if the globe is paused.
    const themeObserver = new MutationObserver(draw);
    themeObserver.observe(document.documentElement, { attributes: true });
    document.addEventListener('visibilitychange', sync);
    reducedMotion.addEventListener('change', sync);
    sync();

    return () => {
      stop();
      resizeObserver.disconnect();
      visibilityObserver.disconnect();
      themeObserver.disconnect();
      document.removeEventListener('visibilitychange', sync);
      reducedMotion.removeEventListener('change', sync);
    };
  }, []);

  return (
    <div
      className={['relative aspect-square w-full rounded-full bg-muted', className]
        .filter(Boolean)
        .join(' ')}
    >
      {/* Dots take the canvas text color; change text-foreground to recolor them. */}
      <canvas
        ref={canvasRef}
        role="img"
        aria-label="Rotating dotted globe"
        className="absolute inset-0 size-full text-foreground"
      />
    </div>
  );
}

```

Works with your AI tools

ClaudeClaude*
CodexCodex*
LovableLovable
Base44Base44
Figma MakeFigma Make
ReplitReplit*
CursorCursor*
v0v0

* Compatible with most projects that use the default React/Next.js framework.

Built With

ReactTailwind CSSCanvas API

Props

PropTypeDescription
classNamestringSize or position the globe. It fills its width as a circle. Dots use text-foreground and the ocean uses bg-muted.

More Animation Components

Make something great.

Typing Animation

A minimal typing animation with smart backspacing, an optional cursor, and adjustable speed.

SVG Blob Animation

Lightweight SVG blob that smoothly morphs between organic shapes with customizable colors and speed.

Confetti Fireworks

A button-triggered canvas confetti burst with a center launch and three quick side volleys.

Signature

A name that signs itself when it appears. The pen lifts once the ink is down.