This document is archived and information here might be outdated.  Recommended version.


How to set the animation environment (ArcObjects .NET 10.4 SDK)

How to set the animation environment


Summary
The animation environment controls a set of variables that affect the playing and exporting of an ArcGIS animation. This topic explains how to set the animation environment and utilize some of its functions.

Setting the animation environment

To set the animation environment, complete the following steps:
  1. Get a handle to the animation extension. The animation environment can be accessed through the animation extension object. The following code example shows how to get the animation extension in ArcGIS for Desktop applications (ArcMap, ArcGlobe, or ArcScene):
[C#]
private IAnimationExtension GetAnimationExtension()
{
    UID pUID=new UID();
    pUID.Value="esriAnimation.AnimationExtension";
    IAnimationExtension animExt;
    animExt=(IAnimationExtension)m_application.FindExtensionByCLSID(pUID);
    return animExt;
}
[VB.NET]
Private Function GetAnimationExtension() As IAnimationExtension
    Dim pUID As New UID
    pUID.Value="esriAnimation.AnimationExtension"
    Dim pAnimExt As IAnimationExtension
    pAnimExt=m_application.FindExtensionByCLSID(pUID)
    GetAnimationExtension=pAnimExt
End Function
  1. Get the animation environment from the animation extension. Typical animation environment variables include the animation duration, play mode, restore state after play option, number of frames in a time layer animation, and so on. The following code example shows how to get the animation environment and set some of the playing options:
[C#]
private void Set_Animation_Environment()
{
    //Get the animation extension. 
    IAnimationExtension animExt;
    animExt=GetAnimationExtension();
    //Get the animation environment from the animation extension. 
    IAGAnimationEnvironment animEnv;
    animEnv=animExt.AnimationEnvironment;
    //Set the duration of animation. 
    animEnv.AnimationDuration=8;
    //Specify the time interval when the animation will be played. 
    animEnv.PutPlayInterval(3.5, 6.7);
    //Set the interval play option to be true. 
    bool intervalPlay;
    intervalPlay=animEnv.IsIntervalPlay;
    if (intervalPlay == false)
    {
        animEnv.IsIntervalPlay=true;
    }
    //Set the play mode to be "play once forward."
    animEnv.PlayMode=esriAnimationPlayMode.esriAnimationPlayOnceForward;
}
[VB.NET]
Private Sub Set_Animation_Environment()
    'Get the animation extension.
    Dim animExt As IAnimationExtension
    animExt=GetAnimationExtension()
    'Get the animation environment from the animation extension.
    Dim animEnv As IAGAnimationEnvironment
    animEnv=animExt.AnimationEnvironment
    'Set the duration of animation.
    animEnv.AnimationDuration=8
    'Specify the time interval when the animation will be played.
    animEnv.PutPlayInterval(3.5, 6.7)
    'Set the interval play option to be true.
    Dim intervalPlay As Boolean
    intervalPlay=animEnv.IsIntervalPlay
    If intervalPlay=False Then
        animEnv.IsIntervalPlay=True
    End If
    'Set the play mode to be "play once forward."
    animEnv.PlayMode=esriAnimationPlayMode.esriAnimationPlayOnceForward
End Sub






Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced