examples/geometries_slice/geometries_slice.js
function updateGeometries() {
  if (stackHelper) {
    // move the "light"
    // update light position
    let timer = Date.now() * 0.00025;
    particleLight.position.x = Math.sin(timer * 7) * 70;
    particleLight.position.y = Math.cos(timer * 5) * 80;
    particleLight.position.z = Math.cos(timer * 3) * 90;

    // re-draw the line
    line.geometry.vertices[0] = stackHelper.slice.planePosition;
    line.geometry.vertices[1] = particleLight.position;
    line.geometry.verticesNeedUpdate = true;

    // update plane direction...
    let dirLPS = new THREE.Vector3(
      particleLight.position.x - stackHelper.slice.planePosition.x,
      particleLight.position.y - stackHelper.slice.planePosition.y,
      particleLight.position.z - stackHelper.slice.planePosition.z
    ).normalize();

    // update slice and THEN its border
    stackHelper.slice.planeDirection = dirLPS;

    // update border with new slice
    stackHelper.border.helpersSlice = stackHelper.slice;

    // update colors based on planeDirection
    let color = rgbToHex(
      Math.round(Math.abs(255 * dirLPS.x)),
      Math.round(Math.abs(255 * dirLPS.y)),
      Math.round(Math.abs(255 * dirLPS.z))
    );
    stackHelper.bbox.color = color;
    stackHelper.border.color = color;
    particleLight.material.color.set(color);
    line.material.color.set(color);
  }
}
function updateGeometries() {
  if (stackHelper) {
    // move the "light"
    // update light position
    let timer = Date.now() * 0.00025;
    particleLight.position.x = Math.sin(timer * 7) * 70;
    particleLight.position.y = Math.cos(timer * 5) * 80;
    particleLight.position.z = Math.cos(timer * 3) * 90;

    // re-draw the line
    line.geometry.vertices[0] = stackHelper.slice.planePosition;
    line.geometry.vertices[1] = particleLight.position;
    line.geometry.verticesNeedUpdate = true;

    // update plane direction...
    let dirLPS = new THREE.Vector3(
      particleLight.position.x - stackHelper.slice.planePosition.x,
      particleLight.position.y - stackHelper.slice.planePosition.y,
      particleLight.position.z - stackHelper.slice.planePosition.z
    ).normalize();

    // update slice and THEN its border
    stackHelper.slice.planeDirection = dirLPS;

    // update border with new slice
    stackHelper.border.helpersSlice = stackHelper.slice;

    // update colors based on planeDirection
    let color = rgbToHex(
      Math.round(Math.abs(255 * dirLPS.x)),
      Math.round(Math.abs(255 * dirLPS.y)),
      Math.round(Math.abs(255 * dirLPS.z))
    );
    stackHelper.bbox.color = color;
    stackHelper.border.color = color;
    particleLight.material.color.set(color);
    line.material.color.set(color);
  }
}
function updateGeometries ( ) { if ( stackHelper ) { // move the "light" // update light position let timer = Date . now ( ) * 0.00025 ; particleLight . position . x = Math . sin ( timer * 7 ) * 70 ; particleLight . position . y = Math . cos ( timer * 5 ) * 80 ; particleLight . position . z = Math . cos ( timer * 3 ) * 90 ; // re-draw the line line . geometry . vertices [ 0 ] = stackHelper . slice . planePosition ; line . geometry . vertices [ 1 ] = particleLight . position ; line . geometry . verticesNeedUpdate = true ; // update plane direction... let dirLPS = new THREE . Vector3 ( particleLight . position . x - stackHelper . slice . planePosition . x , particleLight . position . y - stackHelper . slice . planePosition . y , particleLight . position . z - stackHelper . slice . planePosition . z ) . normalize ( ) ; // update slice and THEN its border stackHelper . slice . planeDirection = dirLPS ; // update border with new slice stackHelper . border . helpersSlice = stackHelper . slice ; // update colors based on planeDirection let color = rgbToHex ( Math . round ( Math . abs ( 255 * dirLPS . x ) ) , Math . round ( Math . abs ( 255 * dirLPS . y ) ) , Math . round ( Math . abs ( 255 * dirLPS . z ) ) ) ; stackHelper . bbox . color = color ; stackHelper . border . color = color ; particleLight . material . color . set ( color ) ; line . material . color . set ( color ) ; } }
Update geometries
Update geometries