Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

three-sphere

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-sphere

3d球

latest
npmnpm
Version
1.0.17
Version published
Maintainers
1
Created
Source

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配置

参数说明类型默认值
radius半径num142
mapImg地球背景图string
transparent地球是否透明booltrue
needHelp是否需要帮助坐标boolfalse
container容器domdocument.getElementById('App')
countryEdge国家边界objnull
countryShape国家面objnull
pointobjnull
point.pointsData点数据arraynull
point[type]点类型(可根据lglt2xyz坐标转换自由添加球面Layer效果)当前支持球波、柱状;point.wave=true(球波); point.column=true(柱状图);null
flyLine飞线objnull
flyLine.lineData飞线数据arraynull
control控制器objnull
control.autoRotate自动旋转boolfalse
control.enableDamping缓冲boolfalse
control.autoRotateSpeed旋转速度num2

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 绘制边/面

FAQs

Package last updated on 13 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts