three-sphere
v1.0.17
Published
3d球
Downloads
18
Readme
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)
}