Work Diagram - Spring (robphy)
Drag A and B to set the limits of the path from A to B. Use the xFromAtoB slider to move the end of the spring. Check Start to animate the path from A to B. Check showHand to show the force and work done by a hand controlling the spring [by keeping the netForce equal to zero]. The equilibrium position is at x=0 (suggested by the grey spring).