My current project involves creating a clock using Text Geometry. To update the time displayed on the clock, I have to remove and recreate a new Text Geometry every time. Unfortunately, this process of adding a new Text Geometry causes my browser to freeze:
// Remove old mesh
earthClockMesh.geometry.dispose();
earthClockMesh.material.dispose();
group.remove(earthClockMesh);
//add new mesh
earthClockMesh = this.getTextMesh(
new Date(diluatedTime).toLocaleString(),
textMaterial
);
group.add(earthClockMesh);
If anyone knows of a more efficient way to update the text in Text Geometry without causing the browser to freeze, please share your insights.
Live Example
https://codesandbox.io/s/peaceful-boyd-x859m
You may notice that the particles temporarily freeze when the TextGeometry is changed.