ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / LayerTrack Class / CreateKeyframe Method
The layer associated with the keyframe.
The time at which to insert the keyframe in the track.
A value indicating if the layer is visible.
The value of the transparency.
The transition for the transparency of the layer. In the UI the default is ArcGIS.Core.CIM.AnimationTransition.Linear.
Example

In This Topic
    CreateKeyframe Method (LayerTrack)
    In This Topic
    Create a new keyframe.
    Syntax
    Public Function CreateKeyframe( _
       ByVal layer As Layer, _
       ByVal atTime As TimeSpan, _
       ByVal isVisibile As Boolean, _
       ByVal transparency As Double, _
       ByVal transition As AnimationTransition _
    ) As Keyframe

    Parameters

    layer
    The layer associated with the keyframe.
    atTime
    The time at which to insert the keyframe in the track.
    isVisibile
    A value indicating if the layer is visible.
    transparency
    The value of the transparency.
    transition
    The transition for the transparency of the layer. 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.
    Example
    Create Layer Keyframe
    public void CreateLayerKeyframe(Layer layer, double transparency, TimeSpan atTime)
    {
      var mapView = MapView.Active;
      if (mapView != null)
        return;
    
      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, ArcGIS.Core.CIM.AnimationTransition.Linear);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also