Affine transformations preserve parallel lines, and include rotations, scaling, shears and translations. Linear transformations can’t perform translations, but this can be achieved if we go to a higher dimension.
In this animation, a planar (2D) shape lying on the plane z = 1 is translated by means of a linear transformation in three dimensions: a shear along the z axis.
Rotations can be performed normally, also around the z axis. For rotations around any other axis parallel to the z axis, it’s just a matter of performing the appropriate translation that cancels out the translation of the axis performed by the rotation.
This way, all transformations are now linear in 3D, and can be represented by a single 3x3 affine transformation matrix that acts on two dimensions.
The “shadow” of the shape illustrates the relative position between the two images, on the planes z = 0 and z = 1, and was included to better visualize the shear and how it is linear in 3D space.