I think he might of used an array of sizes (dimension width and height). And told the box to reajust itself to the right dimension according to the button that was pressed.
He may of used deceleration in his transition to create the illusion of morphing.
Sorry I don’t know any tutorial.
Creating engaging and entertaining content for designers and developers since 1998.