ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / CameraTrack Class / CreateKeyframe Method / CreateKeyframe(Camera,TimeSpan,AnimationTransition) Method
The value of the camera.
The time at which to insert the keyframe in the track. In the UI the default is ArcGIS.Core.CIM.AnimationTransition.FixedArc.
The transition for keyframe.
Example

In This Topic
    CreateKeyframe(Camera,TimeSpan,AnimationTransition) Method
    In This Topic
    Create a new keyframe.
    Syntax
    Public Overloads Function CreateKeyframe( _
       ByVal camera As Camera, _
       ByVal atTime As TimeSpan, _
       ByVal transition As AnimationTransition _
    ) As Keyframe

    Parameters

    camera
    The value of the camera.
    atTime
    The time at which to insert the keyframe in the track. In the UI the default is ArcGIS.Core.CIM.AnimationTransition.FixedArc.
    transition
    The transition for keyframe.
    Remarks
    If a keyframe already exists at that time it will be overwritten. The time is rounded to the nearest millisecond. When you create a keyframe the specified transition will be used for all the values of the camera. It is possible to change the transitions for the individual values of the camera by settting the transition for the value on the keyframe./>
    Example
    Create Camera Keyframe
    public void CreateCameraKeyframe(TimeSpan atTime)
    {
      var mapView = MapView.Active;
      if (mapView != null)
        return;
    
      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, ArcGIS.Core.CIM.AnimationTransition.FixedArc);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also