I always hated this kind of thing.
You start with a 2D object (x- & y- axes) made up of other 2D objects, you then apply an altitude to a copy of them, so that you have a series of flat shapes floating above the (x,y,0) plane. Apply an outline in the (x,y,0) plane and fill it with a background colour.
Draw in the surfaces connecting the (x,y,0) shape to the (x,y,z) shape using the colour of your choice (in this case, the boundary colour).
Drop the object into a 3-D rotation package (this is the bit that really, really hurts when you try to write it yourself), and set a series of transitions and shading options - the one in your GIF is quite basic, and away you go.
3D rotation and shading engines are best presented as objects with pre-settable parameters for shading, shadow, light source options, etc. and with a call that takes an object descriptor, rotation(α,β,γ), translation(x,y,z) etc.
High-level 3D engines tend to be rather slow and glitchy, but a proper, optimised 3D library can be both fast and seamless. Only compiling in the necessary features helps.