How would i make a weapon sway affect when i move camera

For example in cod when you move the camera fast the weapon would move in the opposite direction. Any help would be great.

Please do not post duplicate threads on the same question :slight_smile: