I’m trying to draw the connecting points slowly using the threejs XYZLoader. In the next code, after the comment “connecting points” scene.add(line) will only load the lines at a time. What would be the best approach to do this? is there a setting I can add in the render() function and then specify the XYZloader to render slowly?
var geometry = new THREE.Geometry();
const loader = new XYZLoader();
loader.load( 'xyz_output/xyz_helix_202.txt', function ( geometry ) {
geometry.center();
const vertexColors = ( geometry.hasAttribute( 'color' ) === true );
const material = new THREE.PointsMaterial( { size: 0.1, vertexColors: vertexColors } );
points = new THREE.Points( geometry, material );
scene.add( points );
//connecting points
const line = new THREE.Line(geometry, lineMaterial);
scene.add(line);
//total sum distances of line
line.computeLineDistances();
let lineSum = line.geometry.getAttribute("lineDistance");
console.log("line sum: " + lineSum.getX(lineSum.count - 1));
});
The full code is in the GitHub repo: https://github.com/onRubik/threeXYZgraphing