Quick Start with Cobe
mainTo use Cobe, create a <canvas> element and pass it to the createGlobe function along with a configuration object. The onRender callback allows you to update parameters (like phi or theta) on every animation frame to create rotation or other animations.
import createGlobe from 'cobe'
let phi = 0
let canvas = document.getElementById("cobe")
const globe = createGlobe(canvas, {
devicePixelRatio: 2,
width: 1000,
height: 1000,
phi: 0,
theta: 0,
dark: 0,
diffuse: 1.2,
scale: 1,
mapSamples: 16000,
mapBrightness: 6,
baseColor: [0.3, 0.3, 0.3],
markerColor: [1, 0.5, 1],
glowColor: [1, 1, 1],
offset: [0, 0],
markers: [
{ location: [37.7595, -122.4367], size: 0.03 },
{ location: [40.7128, -74.006], size: 0.1, color: [1, 0, 0] },
],
arcs: [
{
from: [37.7595, -122.4367],
to: [40.7128, -74.006],
color: [1, 0.5, 0.5],
},
],
arcColor: [1, 0.5, 1],
arcWidth: 0.5,
arcHeight: 0.3,
markerElevation: 0.02,
onRender: (state) => {
state.phi = phi
phi += 0.01
},
})
// To destroy the instance and bindings:
// globe.destroy()