Repository: ManimCommunity/manim
File: manim/scene/three_d_scene.py (Python)

Code before:
        except:
            raise ValueError("Invalid ambient rotation angle.")

    def stop_ambient_camera_rotation(self, about="theta"):
        """
        This method stops all ambient camera rotation.
        """
        about: str = about.lower()
        try:
            if config.renderer != "opengl":
                trackers = {
                    "theta": self.camera.theta_tracker,
                    "phi": self.camera.phi_tracker,
                    "gamma": self.camera.gamma_tracker,
                }
                x: ValueTracker = trackers[about]
                x.clear_updaters()
                self.remove(x)
            else:
                self.camera.clear_updaters()
        except:
            raise ValueError("Invalid ambient rotation angle.")

    def begin_3dillusion_camera_rotation(
        self,
        rate: Optional[float] = 1,
        origin_phi: Optional[float] = None,
        origin_theta: Optional[float] = None,
    ):
        """
        This method creates a 3D camera rotation illusion around the current camera orientation.

        Parameters
        ----------
        rate : int or float, optional
            The rate at which the camera rotation illusion should operate.
        origin_phi : int or float, optional
            The polar angle the camera should move around. Defaults to the current phi angle.
        origin_theta : int or float, optional
            The azimutal angle the camera should move around. Defaults to the current theta angle.
        """
        if origin_theta is None:
            origin_theta = self.renderer.camera.theta_tracker.get_value()
        if origin_phi is None:
            origin_phi = self.renderer.camera.phi_tracker.get_value()

        val_tracker_theta = ValueTracker(0)

        def update_theta(m, dt):
            val_tracker_theta.increment_value(dt * rate)
            val_for_left_right = 0.2 * np.sin(val_tracker_theta.get_value())

Review comment (suggestion):
Looking at the code I don't see how `rate` can be `Optional` (i.e., allowed to be `None`).

```suggestion
        rate: float = 1,
```

Code after:
        except:
            raise ValueError("Invalid ambient rotation angle.")

    def stop_ambient_camera_rotation(self, about="theta"):
        """
        This method stops all ambient camera rotation.
        """
        about: str = about.lower()
        try:
            if config.renderer != "opengl":
                trackers = {
                    "theta": self.camera.theta_tracker,
                    "phi": self.camera.phi_tracker,
                    "gamma": self.camera.gamma_tracker,
                }
                x: ValueTracker = trackers[about]
                x.clear_updaters()
                self.remove(x)
            else:
                self.camera.clear_updaters()
        except:
            raise ValueError("Invalid ambient rotation angle.")

    def begin_3dillusion_camera_rotation(
        self,
        rate: float = 1,
        origin_phi: Optional[float] = None,
        origin_theta: Optional[float] = None,
    ):
        """
        This method creates a 3D camera rotation illusion around
        the current camera orientation.

        Parameters
        ----------
        rate
            The rate at which the camera rotation illusion should operate.
        origin_phi
            The polar angle the camera should move around. Defaults
            to the current phi angle.
        origin_theta
            The azimutal angle the camera should move around. Defaults
            to the current theta angle.
        """
        if origin_theta is None:
            origin_theta = self.renderer.camera.theta_tracker.get_value()
        if origin_phi is None:
            origin_phi = self.renderer.camera.phi_tracker.get_value()

        val_tracker_theta = ValueTracker(0)