This is the implementation of a cube that can rotate in all 6DoF.
It is implemented in JS and uses WebGL for rendering.
Most of the source code was copied from a tutorial by Indigo Code and adapted to work as intended.
Open the HTML file in a browser that supports WebGL or experimental-WebGL. The cube will appear.
In order translate it use left and right arrows to move in the X axis, up and down arrows to move it in the Y axis and left control and left shift to move in the Z axis.
To rotate the cube in the Z axis use A and D. For the X axis use W and S. Finally, for the Y axis use Z and X.