Install
npx skills add https://github.com/MengTo/Skills --skill cobejscobe.js — Lightweight WebGL Globe Skill
When to use
- A “spinning globe” / location markers in hero or about pages
- You want a small, focused globe lib (not full three.js)
- Decorative + interactive (markers, rotation) with minimal setup
Key APIs/patterns
- Core:
import createGlobe from "cobe"const globe = createGlobe(canvas, { ...options, onRender(state) { ... } })
- Important options (common):
devicePixelRatio,width,heightphi,theta(rotation angles)scale,dark,diffusebaseColor,markerColor,glowColormarkers: [{ location: [lat, lon], size, color? }]
- Lifecycle:
globe.toggle()pauses RAFglobe.destroy()removes instance
Common pitfalls
- Canvas sizing mismatch
- Set CSS size AND set canvas
width/heightscaled for DPR.
- Set CSS size AND set canvas
- Not updating on resize
- Recompute width/height and recreate or update params.
- Too high DPR on mobile
- Clamp DPR to 1–2.
Quick recipe: responsive globe with markers
What to ask the user
- Globe size and placement (hero, section, card)?
- Marker locations + colors (brand-aligned)?
- Interaction needs (drag to rotate vs. ambient spin)?