🏠 back to Observable

After changing a THREE.js cell, why do I have to reload the page to make it run smoothly?

I’ve decided I want to make a 3D graphing calculator with THREE.js. When I change the equation, or modify the THREE.js widow’s code, the framerate goes down, and I have to restart the page to get it to run smoothly again. I’m using buffer geometry, and I’m suspecting the old data isn’t being cleared when the window is updated. Anyone know how to fix this? The two ways I can think of is to automatically clear the old memory, or someone make a mutable function so changing it doesn’t cause the cell to restart.

2 Likes

Your analysis is correct. The recursive calls to requestAnimationFrame never stop. I’ve sent you a suggestion that animates from “outside” the cell.

1 Like

That solved the problem, mucho gracias! I had no idea you could control the updating externally. I’ll definitely be using that trick in the future.