ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TimeTrack Class / CreateKeyframe Method
The value of the current time.
The time at which to insert the keyframe in the track.
The transition for start and end time of the time range. In the UI the default is ArcGIS.Core.CIM.AnimationTransition.Linear.
Example

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

    Parameters

    time
    The value of the current time.
    atTime
    The time at which to insert the keyframe in the track.
    transition
    The transition for start and end time of the time range. In the UI the default is ArcGIS.Core.CIM.AnimationTransition.Linear.
    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 the start and end time of the time range. It is possible to change the transitions for the start or end time by settting the transition on the keyframe./>
    Example
    Create Time Keyframe
    public void CreateTimeKeyframe(TimeSpan atTime)
    {
      var mapView = MapView.Active;
      if (mapView != null)
        return;
    
      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, ArcGIS.Core.CIM.AnimationTransition.Linear);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also