ArcGIS Pro 2.7 API Reference Guide
CreateKeyframe Method (TimeTrack)
Example 

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.
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 a new time keyframe from the active map view.
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 10, Windows 8.1

See Also

Reference

TimeTrack Class
TimeTrack Members