Make sure you check out the description for a detailed explanation of what's happening here. I've also coded the same chamfering process for a tetrahedron.

Sorry, it appears your browser does not support registering custom properties via @property (in order to animate them), so the morphing animation in this demo does not work (only the cube rotation). Here is a recording of what it should look like.