我有30,000个顶点,尝试为它们制作动画,但此时性能下降有关于如何改进代码的建议吗?
function createParticle() {
let tween;
_.times(30000, n => {
let vertex = shirt.geometry.vertices[n];
let particle = particles.vertices[n];
particle.x = 15 * 20;
particle.y = 16 * 20;
particle.z = 14 * 20;
tween = new TWEEN.Tween(particle)
.to({
x: vertex.x * shirt.scale.x,
y: vertex.y * shirt.scale.y,
z: vertex.z * shirt.scale.z
}, 3000)
.onUpdate(function() {
particleSystem.geometry.verticesNeedUpdate = true;
})
.easing(TWEEN.Easing.Sinusoidal.InOut)
.start();
});
}