ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Animation Class / Duration Property
Example

In This Topic
    Duration Property (Animation)
    In This Topic
    Gets the length of time of all tracks in the animation.
    Syntax
    public TimeSpan Duration {get;}
    Public ReadOnly Property Duration As TimeSpan
    Example
    Set Animation Length
    public void SetAnimationLength(TimeSpan length)
    {
      var mapView = MapView.Active;
      if (mapView != null)
        return;
    
      var animation = mapView.Map.Animation;
      var duration = animation.Duration;
      if (duration == TimeSpan.Zero)
        return;
    
      var factor = length.TotalSeconds / duration.TotalSeconds;
      animation.ScaleDuration(factor);
    }
    Scale Animation
    public void ScaleAnimationAfterTime(TimeSpan afterTime, TimeSpan length)
    {
      var mapView = MapView.Active;
      if (mapView != null)
        return;
    
      var animation = mapView.Map.Animation;
      var duration = animation.Duration;
      if (duration == TimeSpan.Zero || duration <= afterTime)
        return;
    
      var factor = length.TotalSeconds / (duration.TotalSeconds - afterTime.TotalSeconds);
      animation.ScaleDuration(afterTime, duration, factor);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also