The principle is to use two "simple deform" modifiers:
- one animated from a circle, bent -360°, (for the torus) to a half circle, bent 180°, for the sphere
- the second to bend around the previous by 360° to give it the volume (torus or sphere)
The base grid is parallel to front view and centered to avoid the usage of empties in the bend modifiers.
Though, we also want here to join correctly the uneven grid borders (top to bottom and left to right):
which means we have to bend more than 360° to join them. And doing so, the mesh won't be a perfect sphere at the end.
So we need to compensate that. This is done with a "cast (to sphere) modifier" centered on an empty placed at the center of the sphere. This modifier is also animated so that its influence is null when the shape is a torus.
That gives us this setting:
- Simple deform around X animated from -380° (*) to 180°
- Simple deform around Z at 369° (*)
- Cast (to sphere) modifier animated from 0 to 0.5
- Weld to get ride of duplicate vertices
- Wireframe
(* these values are tuned to that border overlap correctly and weld modifier works on them)