Partial rendering when camera moves

I am new to three js. Trying to create 10000 boxes which all of them have different animations and at the same time they all have image texture on them. I was able to create like 200 but my animate function has like 400 line of code now, because I assigned animations one by one.

  1. How can I actually provide these much animation in more beneficial way. Can I assign the animation directly to the object without providing it in animation function?
  2. How do we handle partial scene rendering? I mean when my camera goes sideways I want to create 1000 boxes on that part, then when I come back to previous part of the scene I want to have my previous boxes back.

Performance wise I can not directly create 10k hude boxes with animations and image textures.

Is there any documentation about this?