1.0.17 • Published 3 years ago

three-sphere v1.0.17

Weekly downloads
3
License
ISC
Repository
-
Last release
3 years ago

CODE

import ThreeSphere from "three-sphere";
import worldTransparent from "./images/world_transparent.jpg";

const container = document.getElementById("earth1");
const threeSphereInstance = new ThreeSphere({
	radius: 142,
	mapImg: worldTransparent,
	transparent: true,
	needHelp: false,
	container: container,
	width: container.clientWidth,
	height: 420,
	countryEdge: {
		drawLine: true
	},
	point: {
		pointsData,
		wave: true
	},
	flyLine: {
		lineData: lineData
	},
	control: {
		autoRotate: true,
		enableDamping: true,
		autoRotateSpeed: 0.4
	}
});
threeSphereInstance.init();

API

ThreeSphere 地球config配置

lglt2xyz 坐标转换

	const lglt2xyz = (lg, lt, r) => {
		const phi = (180 + lg) * (Math.PI / 180)
		const theta = (90 - lt) * (Math.PI / 180)
		const x = -r * Math.sin(theta) * Math.cos(phi);
		const y = r * Math.cos(theta);
		const z = r * Math.sin(theta) * Math.sin(phi);
		return new THREE.Vector3(x,y,z)
	}

Draw 绘制边/面

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago