How can I pan the camera with code?

So I had the idea “tracking” the ball by animating the camera but it doesn’t perfectly follow the ball and sometimes lags the game as well. My idea was to have a slight pan upwards and tilt to get a better view of the pins being struck. Is there anyway to create a slight drag on the camera and also have it move up/tilt down through code?