The animation shows a simplified stepper motor end on. The red and the blue teeth are at either end of permanent magnet.

Notice how the current in the outside stator coils appears to rotate clockwise.
The motor rotates as current is fed in sequence, forwards and backwards, to the two pairs of stator coils,
thereby creating a rotating magnetic field which the magnetised rotor teeth follow.

Actual stepper motors have more stator and rotor teeth

The #D graphic is an edited clip from the YouTube Movie: How do stepper motors work?