function init() {
  /**
   * Animation loop
   */
  function animate() {
    updateGeometries();
    render();

    // request new frame
    requestAnimationFrame(function() {
      animate();
    });
  }

  // renderer
  threeD = document.getElementById('r3d');
  renderer = new THREE.WebGLRenderer({
    antialias: true,
  });
  renderer.setSize(threeD.offsetWidth, threeD.offsetHeight);
  renderer.setClearColor(0x353535, 1);
  renderer.setPixelRatio(window.devicePixelRatio);
  threeD.appendChild(renderer.domElement);

  // stats
  stats = new Stats();
  threeD.appendChild(stats.domElement);

  // scene
  scene = new THREE.Scene();

  // camera
  camera = new THREE.PerspectiveCamera(
    45,
    threeD.offsetWidth / threeD.offsetHeight,
    0.01,
    10000000
  );
  camera.position.x = 150;
  camera.position.y = 150;
  camera.position.z = 100;

  // controls
  controls = new ControlsTrackball(camera, threeD);
  controls.rotateSpeed = 1.4;
  controls.zoomSpeed = 1.2;
  controls.panSpeed = 0.8;
  controls.noZoom = false;
  controls.noPan = false;
  controls.dynamicDampingFactor = 0.3;

  particleLight = new THREE.Mesh(
    new THREE.SphereGeometry(2, 8, 8),
    new THREE.MeshBasicMaterial({ color: 0xfff336 })
  );
  scene.add(particleLight);

  animate();
}
function init() {
  
  function animate() {
    updateGeometries();
    render();

    
    requestAnimationFrame(function() {
      animate();
    });
  }

  
  threeD = document.getElementById('r3d');
  renderer = new THREE.WebGLRenderer({
    antialias: true,
  });
  renderer.setSize(threeD.offsetWidth, threeD.offsetHeight);
  renderer.setClearColor(0x353535, 1);
  renderer.setPixelRatio(window.devicePixelRatio);
  threeD.appendChild(renderer.domElement);

  
  stats = new Stats();
  threeD.appendChild(stats.domElement);

  
  scene = new THREE.Scene();

  
  camera = new THREE.PerspectiveCamera(
    45,
    threeD.offsetWidth / threeD.offsetHeight,
    0.01,
    10000000
  );
  camera.position.x = 150;
  camera.position.y = 150;
  camera.position.z = 100;

  
  controls = new ControlsTrackball(camera, threeD);
  controls.rotateSpeed = 1.4;
  controls.zoomSpeed = 1.2;
  controls.panSpeed = 0.8;
  controls.noZoom = false;
  controls.noPan = false;
  controls.dynamicDampingFactor = 0.3;

  particleLight = new THREE.Mesh(
    new THREE.SphereGeometry(2, 8, 8),
    new THREE.MeshBasicMaterial({ color: 0xfff336 })
  );
  scene.add(particleLight);

  animate();
}
function init ( ) { /**
   * Animation loop
   */ function animate ( ) { updateGeometries ( ) ; render ( ) ; // request new frame requestAnimationFrame ( function ( ) { animate ( ) ; } ) ; } // renderer threeD = document . getElementById ( 'r3d' ) ; renderer = new THREE . WebGLRenderer ( { antialias : true , } ) ; renderer . setSize ( threeD . offsetWidth , threeD . offsetHeight ) ; renderer . setClearColor ( 0x353535 , 1 ) ; renderer . setPixelRatio ( window . devicePixelRatio ) ; threeD . appendChild ( renderer . domElement ) ; // stats stats = new Stats ( ) ; threeD . appendChild ( stats . domElement ) ; // scene scene = new THREE . Scene ( ) ; // camera camera = new THREE . PerspectiveCamera ( 45 , threeD . offsetWidth / threeD . offsetHeight , 0.01 , 10000000 ) ; camera . position . x = 150 ; camera . position . y = 150 ; camera . position . z = 100 ; // controls controls = new ControlsTrackball ( camera , threeD ) ; controls . rotateSpeed = 1.4 ; controls . zoomSpeed = 1.2 ; controls . panSpeed = 0.8 ; controls . noZoom = false ; controls . noPan = false ; controls . dynamicDampingFactor = 0.3 ; particleLight = new THREE . Mesh ( new THREE . SphereGeometry ( 2 , 8 , 8 ) , new THREE . MeshBasicMaterial ( { color : 0xfff336 } ) ) ; scene . add ( particleLight ) ; animate ( ) ; }
Initialize the scene
Initialize the scene