Skip to main content
Standalone hook for smooth camera animation. Works with OrbitControls or any camera setup.

Usage

Return Value

getCameraState()

Returns the current camera position and orbit target.

moveCameraTo(position, target, durationMs)

Smoothly animate the camera to a new position and look-at target.
THREE.Vector3
required
Target camera position.
THREE.Vector3
required
Target look-at point.
number
required
Animation duration in milliseconds.
Returns: Promise<void> — resolves when animation completes.

Example: Vision Pipeline

Notes

  • Must be called inside <MujocoCanvas> (needs R3F’s useThree)
  • Uses cubic ease-out for smooth interpolation
  • Animates both camera position and OrbitControls target
  • Only one animation runs at a time — starting a new one cancels the previous