The ideal way is to rig it first, then to animate it. Even if you rig it now, it will be a bit hard to transfer the animation back to the rig.
Whether the animation can work as is or not, depends on where you want to use it. Right now, it will be a bit complex as you'll end up with a separate action for each object.
If you can share the file, I can give you more details on how to convert it to a rigged asset.
Edit: I transferred the animation to an armature I created. The steps I followed are listed below.
- Reduce the number of objects as much as possible by joining them together making sure to apply modifiers. The remaining objects should be the ones that have animations. The Empty object was added to replace one of the objects I merged which was by another object's modifier.
List of objects before:
List of objects after:
- I noticed that the origin of the box was inside it. Typically, for assets that sit on the ground, the origin should be at the bottom. I moved the objects up to achieve that by introducing an empty object, making it the parent of the top level objects, then moving it up.
I created an armature with a bone for every mesh object at its origin. I had to add an extra bone for a mirrored animation.
With constraints, I made each bone a child of its respective object. The mirrored animation required a different setup as it doesn't have a source object. For this one, I parented it to the lid, then copied an inverted rotation from the original bone (on the opposite side). Now, when I play the animation, the bones follow the objects as if the mesh was skinned to the rig.
I baked the animation of the bones removing the constraints.
Since I have the animation on the armature, it was safe to merge all objects down into one mesh, but before that, I assigned the weights for each separate object to its respective bone.
After merging all objects into one, I parented it with an Armature Deform to the armature.
I cleaned the file by removing temp empty objects and remaining object animations.
The only thing I would like to do now is to introduce some hierarchy to the bones, but I will let OP decide if that's necessary.
You can download the file from here.