Added orbital camera
parent
97413eb7bb
commit
6b96d2b519
13
main.js
13
main.js
|
@ -2,6 +2,8 @@ import * as THREE from 'three';
|
||||||
|
|
||||||
import * as SHAPES from './shapes.js';
|
import * as SHAPES from './shapes.js';
|
||||||
|
|
||||||
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
||||||
|
|
||||||
const NODE_SIZE = 0.07;
|
const NODE_SIZE = 0.07;
|
||||||
const LINK_SIZE = 0.03;
|
const LINK_SIZE = 0.03;
|
||||||
const NODE_OPACITY = 1.0;
|
const NODE_OPACITY = 1.0;
|
||||||
|
@ -188,7 +190,7 @@ light.position.set(10, 10, 10);
|
||||||
scene.add(light);
|
scene.add(light);
|
||||||
|
|
||||||
|
|
||||||
const amblight = new THREE.AmbientLight(0xffffff, 0.2);
|
const amblight = new THREE.AmbientLight(0xffffff, 0.5);
|
||||||
scene.add(amblight);
|
scene.add(amblight);
|
||||||
|
|
||||||
scene.background = new THREE.Color(0xdddddd);
|
scene.background = new THREE.Color(0xdddddd);
|
||||||
|
@ -197,6 +199,14 @@ const renderer = new THREE.WebGLRenderer({antialias: true});
|
||||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||||
document.body.appendChild( renderer.domElement );
|
document.body.appendChild( renderer.domElement );
|
||||||
|
|
||||||
|
|
||||||
|
const controls = new OrbitControls( camera, renderer.domElement );
|
||||||
|
controls.target.set( 0, 0, 0 );
|
||||||
|
controls.update();
|
||||||
|
controls.enablePan = false;
|
||||||
|
controls.enableDamping = true;
|
||||||
|
|
||||||
|
|
||||||
const node_m = new THREE.MeshStandardMaterial(
|
const node_m = new THREE.MeshStandardMaterial(
|
||||||
{ color: 0x990044 } );
|
{ color: 0x990044 } );
|
||||||
|
|
||||||
|
@ -228,6 +238,7 @@ scene.add(shape);
|
||||||
|
|
||||||
camera.position.z = 4;
|
camera.position.z = 4;
|
||||||
|
|
||||||
|
|
||||||
let theta = 0;
|
let theta = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue