how to animate a gradient moving over an object
This can be achieved by animating the Location in the Mapping node, and adding a few math nodes between the Separate XYZ node and the ColorRamp node, like this:



The ColorRamp uses values between 0 and 1, and if you input anything outside this range, it gets clamped (i.e. anything greater than 1 becomes 1, and anything less than 0 becomes 0). These math nodes make sure you get a value in the expected range.

The Modulo node with the lower value set to 1, basically preserves only what comes after the decimal point, i.e. 1.5, 2.5, 3.5 and so on all become 0.5, and -1.5, -2.5, -3.5 and so on all become -0.5. So this gives us a value in the range -1 to 1.

The Less Than node with the lower value set to 0 outputs 1 if the upper input is below 0 and 0 if it's equal to or greater than 0.

The Add node simply adds the output from the Modulo and the Less Than nodes, thus fixing negative values. So now we have a value in the expected range.



To animate, hold the mouse pointer over the Location properties in the mapping node, and either press I or right click and select Insert Keyframes or Insert Single Keyframe. The former adds keyframes to all three location properties and the latter adds a keyframe to the one the mouse pointer is on. Move the timeline a number of frames, change the appropriate location value(s) and add keyframes again. Repeat as many times as needed.
N.B. The nodes above only affect the Z location. It can easily be changed to either the X or Y location, by using the corresponding output from the Separate XYZ.