ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Animation Class
Members Example

In This Topic
    Animation Class
    In This Topic
    Represents the collection of tracks, keyframes and transitions that define an animation for the map.
    Syntax
    Public NotInheritable Class Animation 
    public sealed class Animation 
    Remarks

    Animation is the process of creating a collection of sequential images and playing them back quickly to create an illusion of movement. Each image, just like a picture you take with a camera, marks a significant instance in time, and is called a keyframe. In ArcGIS Pro, animations are authored by defining a set of keyframes that the system uses to create interpolated intermediate frames. Animations can interpolate the camera position, map time, map range, and layer visibility and transparency.

    An instance of this class is returned from the Map.Animation property and can be used to manipulate the state of the animation by creating, editing and deleting keyframes.

    Example
    Set Animation Length
    {
      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
    {
      var animation = mapView.Map.Animation;
      var duration = animation.Duration;
      if (duration == TimeSpan.Zero || duration <= afterTime)
      {
        // Nothing to scale, leave
      }
    
      var factor = length.TotalSeconds / (duration.TotalSeconds - afterTime.TotalSeconds);
      animation.ScaleDuration(afterTime, duration, factor);
    }
    Camera Keyframes
    {
      var animation = mapView.Map.Animation;
      var cameraTrack = animation.Tracks.OfType<CameraTrack>().First(); //There will always be only 1 CameraTrack in the animation.
      var result = cameraTrack.Keyframes.OfType<CameraKeyframe>().ToList();
      //Use the camera keyframes (if any)
    }
    Create Camera Keyframe
    {
      var animation = mapView.Map.Animation;
      var cameraTrack = animation.Tracks.OfType<CameraTrack>().First(); //There will always be only 1 CameraTrack in the animation.
      cameraTrack.CreateKeyframe(mapView.Camera, atTime, AnimationTransition.FixedArc);
    }
    Create Time Keyframe
    {
      var animation = mapView.Map.Animation;
      var timeTrack = animation.Tracks.OfType<TimeTrack>().First(); //There will always be only 1 TimeTrack in the animation.
      timeTrack.CreateKeyframe(mapView.Time, atTime, AnimationTransition.Linear);
    }
    Create Range Keyframe
    {
      var animation = mapView.Map.Animation;
      var rangeTrack = animation.Tracks.OfType<RangeTrack>().First(); //There will always be only 1 RangeTrack in the animation.
      rangeTrack.CreateKeyframe(range, atTime, AnimationTransition.Linear);
    }
    Create Layer Keyframe
    {
      var animation = mapView.Map.Animation;
      var layerTrack = animation.Tracks.OfType<LayerTrack>().First(); //There will always be only 1 LayerTrack in the animation.
      layerTrack.CreateKeyframe(layer, atTime, true, transparency, AnimationTransition.Linear);
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Mapping.Animation

    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also