In general, forces are variable; so we must treat the case in which the forces are allowed to change. A good example of a variable force is that produced by a spring as it is stretched or compressed:
Hooke's Law:
where k is the spring constant with units N/m, and in the last step we have set 0 = 0 (defined the origin). This way represents the elongation from the equilibrium position. Note that the spring force will have opposite sign, when the spring is stretched or compressed.
In this movie, the force exerted by the spring on the block is represented by a black arrow. Note that we cannot use our previous results for a constant force to determine the work done. Instead, we really will have to integrate. The integral will give the same value as the average force times the distance. The arrow in the movie indicates both the magnitude and the direction of the force depend on the elongation.