When spacecraft are moving around close to each other it's called 'Proximity Operations', the same laws of physics apply, but we move the reference frame to the target spacecraft which means we see what looks like unexpected motion with spacecraft following ellipses and other paths not seen on earth. But these simple motions can be modelled by equations and easily broken down into simple harmonic motion.