I have a THREE.Points object consisting of many (10,000+) vertices (a.k.a. particles).
However, I run into performance problems when I try to tween the location of the individual particles. This is expected given that I am using the following code which loops through all the particles and assigns each a tween.
var duration = 500;
for( var i = 0; i < particles.geometry.vertices.length; i++ ){
// http://threejs.org/examples/css3d_sprites.html
var currentVertex = particles.geometry.vertices[i];
new TWEEN.Tween( currentVertex )
.to(
{
x: newVertices[i].x,
y: newVertices[i].y,
z: newVertices[i].z,
},
duration * ( Math.random() + 1 )
)
.easing( TWEEN.Easing.Exponential.InOut )
.onUpdate( function(){
particles.geometry.verticesNeedUpdate = true;
})
.start();
}
Is there a better way to approach this?
I do not mind if all the particles are updated in one draw call to their new inbetween positions.