Hint: Keep two running angles theta and phi for the rotation about the Y axis and X axis, respectively. At each frame, construct a camera transform matrix, as a translation by (0,0,10), followed by rotations of theta and phi about the X and Y axes, respectively. Then use the procedure we learned in class to obtain the inverse of this matrix. Transform each sphere center by that inverse matrix to move all the spheres into view, and render the image.
The complete procedure to follow at each pixel is: