This is a famous mathematical modeling problem.
A bean attached one end of the spring with free force length L0 and spring constant k.
It is also confined to move along a wire.
The height of the wire can be adjusted if you drag the left end up/down.
The tilt angle of the wire can be adjusted if you drag the right end up/down.
The force and velocity vectors are shown with blue/red arrows.
Phase diagram of vx-x is shown in the right plotting region.