ArcGIS Pro 2.9 API Reference Guide
CreateKeyframe Method (RangeTrack)
Example 

ArcGIS.Desktop.Mapping Namespace > RangeTrack Class : CreateKeyframe Method
The value of the range.
The time at which to insert the keyframe in the track.
The transition for min and max value of the range. In the UI the default is ArcGIS.Core.CIM.AnimationTransition.Linear.
Create a new keyframe.
Syntax
Public Function CreateKeyframe( _
   ByVal range As Range, _
   ByVal atTime As TimeSpan, _
   ByVal transition As AnimationTransition _
) As Keyframe

Parameters

range
The value of the range.
atTime
The time at which to insert the keyframe in the track.
transition
The transition for min and max value of the 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 min and max values of the range. It is possible to change the transitions for the min or max by settting the transition on the keyframe./>
Example
Create a new range keyframe.
public void CreateRangeKeyframe(Range range, TimeSpan atTime)
{
  var mapView = MapView.Active;
  if (mapView != null)
    return;

  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, ArcGIS.Core.CIM.AnimationTransition.Linear);
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

RangeTrack Class
RangeTrack Members