
[code]
<script src="//unpkg.com/d3-array"></script>
<script src="//unpkg.com/d3-scale"></script>
<script src="//unpkg.com/three"></script>
<script src="//unpkg.com/globe.gl"></script>
<!--<script src="../../dist/globe.gl.js"></script>-->
<rssapp-ticker id="WnIWA7UzVTCyLaaW"></rssapp-ticker><script src="https://widget.rss.app/v1/ticker.js" type="text/javascript" async></script>
<div id="globeViz"></div>
<script>
const colorScale = d3.scaleOrdinal(['orangered', 'mediumblue', 'darkgreen', 'yellow']);
const labelsTopOrientation = new Set(['Apollo 12', 'Luna 2', 'Luna 20', 'Luna 21', 'Luna 24', 'LCROSS Probe']); // avoid label collisions
const elem = document.getElementById('globeViz');
const moon = Globe()
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
.bumpImageUrl('//unpkg.com/three-globe/example/img/earth-topology.png')
.backgroundImageUrl('//unpkg.com/three-globe/example/img/night-sky.png')
.showGraticules(true)
.showAtmosphere(true) // moon has no atmosphere
.labelText('label')
.labelSize(1.7)
.labelDotRadius(0.4)
.labelDotOrientation(d => labelsTopOrientation.has(d.label) ? 'top' : 'bottom')
.labelColor(d => colorScale(d.agency))
.labelLabel(d =>
`
<div><b>${d.label}</b></div>
<div>${d.agency} - ${d.program} Program</div>
<div>Landing on <i>${new Date(d.date).toLocaleDateString()}</i></div>
`)
.onLabelClick(d => window.open(d.url, '_blank'))
(elem);
fetch('https://shange-fagan.github.io/globe.news/moon_landings.json') // make the request to fetch https://raw.githubusercontent.com/eesur/country-codes-lat-long/e20f140202afbb65addc13cad120302db26f119a/country-codes-lat-long-alpha3.json
// fetch('https://raw.githubusercontent.com/eesur/country-codes-lat-long/e20f140202afbb65addc13cad120302db26f119a/country-codes-lat-long-alpha3.json')
.then(r => r.json()) //then get the returned json request header if and when the request value returns true
.then(landingSites => { // then use the request result as a callback
console.log(landingSites)
// moon.labelsData(landingSites.ref_country_codes);
moon.labelsData(landingSites);
console.log(moon.labelLabel)
// custom globe material
const globeMaterial = moon.globeMaterial();
globeMaterial.bumpScale = 10;
new THREE.TextureLoader().load('//unpkg.com/three-globe/example/img/earth-water.png', texture => {
globeMaterial.specularMap = texture;
globeMaterial.specular = new THREE.Color('grey');
globeMaterial.shininess = 15;
});
setTimeout(() => { // wait for scene to be populated (asynchronously)
const directionalLight = moon.scene().children.find(obj3d => obj3d.type === 'DirectionalLight');
directionalLight && directionalLight.position.set(1, 1, 1); // change light position to see the specularMap's effect
});
});
//moon.controls().autoRotate = false;
//moon.controls().autoRotateSpeed = 0.85;
//const animate = () => {
//requestAnimationFrame(animate);
//moon.rotation.y += 0.01;
//}
//animate();
</script>
[/code]
게시글 목록
| 번호 | 제목 |
|---|---|
| 17819 |
JavaScript
당신이 알아야 할 자바스크립트의 강력한 7가지 팁
3
|
| 17818 |
JavaScript
자바스크립트 코드를 더 깔끔하고 보기 좋게 작성하는 팁
1
|
| 17817 |
PHP
chatgtp
|
| 17816 |
JavaScript
textarea 자동 높이 설정하기.
1
|
| 17814 | |
| 17811 |
JavaScript
자바스크립트 플래이그라운드 - RUNJS
|
| 17810 | |
| 17809 | |
| 17808 |
JavaScript
16진수 색상코드 확인함수
|
| 17803 | |
| 17799 | |
| 17798 | |
| 17797 |
JavaScript
동영상파일 썸네일 만들기
8
|
| 17795 |
JavaScript
div태그의 사이즈가 변경되는 이벤트를 처리하기
|
| 17794 |
JavaScript
초->hh:mm:ss로 변환하는 함수
1
|
| 17793 |
JavaScript
JSON Beautify
|
| 17790 |
PHP
JSONP실례
|
| 17789 | |
| 17786 |
JavaScript
ThreeJS로 3디지구에 포인트 찍고 정보 현시기능
현재글
|
| 17774 | |
| 17760 | |
| 17755 | |
| 17750 | |
| 17729 | |
| 17722 | |
| 17714 | |
| 17708 | |
| 17686 | |
| 17676 |
JavaScript
유튜브 풀화면 묵음배경 예제
9
|
| 17666 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기