1.0.5 • Published 3 years ago

react-3d-earth v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago
 

Getting started

npm install react-3d-earth

or

yarn add react-3d-earth
import React from "react";
import React3dEarth from 'react-3d-earth'
export const App = () => <div>
    <React3dEarth
        style={{width: '100%', height: '100vh',position:'absolute',zIndex:'0'}}
</div>

or

export const App = () => <div>
    <React3dEarth
        style={{width: '100%', height: '100vh',position:'absolute',zIndex:'0'}}
        config={{
          // radius: 30,
          // mobileRadius: 20,
          // backgroundColor: '#fafafa',
          // flagScale:1,
          // flagLat:39.56,
          // flagLon: 116.20,
          // flagColor: 'green'
          // dotColor: 'hotpink'
          // autoRotationSpeed: 3,
          // draggingRotationSpeed:5,
          // textureSrc: '/images/map.png'
        }}/>
</div>

config

porptypedefault备注
radiusnumber25地球半径大小
mobileRadiusnumber25在移动端时地球半径大小
textureSrcstring''自定义地图纹理地址
backgroundColorstring#040d21背景颜色
flagScalenumber1旗子放大倍数
flagLatnumber39.56旗子在地球上的纬度
flagLonnumber116.20旗子在地球上的经度
flagColorstring旗子颜色
dotColorstring地球上点的颜色
autoRotationSpeednumber0.15自动转动的速度
draggingRotationSpeednumber3拖动时转动的速度

demo

https://www.haoolee.com

earth