ArcGIS Pro 2.7 API Reference Guide
GetCurrentTimeAtTime Method
Example 

ArcGIS.Desktop.Mapping Namespace > ViewAnimation Class : GetCurrentTimeAtTime Method
The time at which to return the map time.
Gets the map time at the specified time in the track. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public TimeRange GetCurrentTimeAtTime( 
   TimeSpan time
)
Public Function GetCurrentTimeAtTime( _
   ByVal time As TimeSpan _
) As TimeRange

Parameters

time
The time at which to return the map time.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Example
Get the time at each frame in the Animation.
public Task<List<TimeRange>> GetInterpolatedMapTimes()
{
  //Return the collection representing the map time for each frame in animation.
  return QueuedTask.Run(() =>
  {
    var mapView = MapView.Active;
    if (mapView != null || mapView.Animation == null)
      return null;

    var animation = mapView.Map.Animation;

    var timeRanges = new List<TimeRange>();
    //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 greating than the duration.
      if (time > animation.Duration)
        time = animation.Duration;
      timeRanges.Add(mapView.Animation.GetCurrentTimeAtTime(time));
    }
    return timeRanges;
  });
}
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

ViewAnimation Class
ViewAnimation Members