ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ViewAnimation Class / GetCameraAtTime Method
The time at which to return the camera.
Example

In This Topic
    GetCameraAtTime Method
    In This Topic
    Gets the camera at the specified time in the track. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetCameraAtTime( _
       ByVal time As TimeSpan _
    ) As Camera
    public Camera GetCameraAtTime( 
       TimeSpan time
    )

    Parameters

    time
    The time at which to return the camera.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Interpolate Camera
    {
      //Return the collection representing the camera for each frame in animation.
      // Note: Needs QueuedTask to run
      {
        var animation = mapView.Map.Animation;
    
        var cameras = new List<Camera>();
        //We will use ticks here rather than milliseconds to get the highest precision possible.
        var ticksPerFrame = Convert.ToInt64(animation.Duration.Ticks / (animation.NumberOfFrames - 1));
        for (int i = 0; i < animation.NumberOfFrames; i++)
        {
          var time = TimeSpan.FromTicks(i * ticksPerFrame);
          //Because of rounding for ticks the last calculated time may be greater than the duration.
          if (time > animation.Duration)
            time = animation.Duration;
          cameras.Add(mapView.Animation.GetCameraAtTime(time));
        }
        // Use cameras
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also