This is a simulation of a rotating 4 dimensional Cube, otherwise known as a Tesseract.
What you are seeing is it Rotating. It is not being distorted, reshaped, or anything like that. it is simply Rotating - It appears to be distorted because you are only seeing the ‘projection’ of it. similarly if you rotated a 3D cube infront of lamp the shadow you would see would appear to distort.
If a mathematicianwants to cross a road, they will think carefully about their optimal path. The total distance of the path should be minimised, but they prefer walking on the sidewalk to the road. If there is no extra discomfort from being on the road, the best path is a straight line, but as it increases it is better to cross the road more directly. The resulting path is exactly the same as a ray of light refracting through a block of glass [with relative refractive index equal to the ratio of these ‘discomfort levels’]. Fermat’s principle says that light will want to spend less time in the glass (on the road), as it actually travels more slowly in the glass. [video] [code] [more]