Hello! I created new composition, set it to 3d and rotated it to 90 degrees. Then I created a camera and placed it above the composition, so that the camera could see it. Then I set camera animation: approaching of the camera from source point to composition. Actually only one coordinate is changing during the animation. But the camera does weird rotations. Why does it happen and how to fix it?
Here is link for my test project: test camera.aep - Google Drive
You are probably seeing gimbal lock and flipping orientation values. You need to read up on the subject and parent your camera to a Null and also not use a target camera but rather a single-node camera with manuallly animated rotation.
But the camera does weird rotations. Why does it happen and how to fix it?
that's because your camera is upside down. this is one of the gotchas with ae cameras.
From "Creating Motion Graphics with After Effects 5th Edition" by Chris & Trish Meyer:
if you animate the position of the camera so it would be upside down, it will automatically orient right side up. if you want to flip the camera, use rotation or parent it to a null object that flips instead.
for the movement you want, you could just rotate the layer instead of the camera, and let the camera dolly in towards it.
Same appearance, different setup:
if you do want the camera to be coming from the top, and it is a 2 node camera, you are going to have to use a rig. this is a good thread about cameras: Trouble navigating with camera in huge 3d scene with links and a lot of good advice.