ArcObjects Library Reference

Create Animation AVI Snippet

Exports the current animation in globe to an AVI file.

[C#]

///<summary>Exports the current animation in globe to an AVI file.</summary>
/// 
///<param name="globe">An IGlobe interface</param>
///<param name="exportFileName">A System.String that is the path and filename of the AVI file to be exported. Example: ex: "C:\temp\myanimation.avi"</param>
///<param name="duration">A System.Double that is the length (or duration) in seconds of the AVI movie. Example: 30</param>
///  
///<remarks></remarks>
public void CreateAnimationAVI(ESRI.ArcGIS.GlobeCore.IGlobe globe, System.String exportFileName, System.Double duration)
{
  // Find the animation extension
  ESRI.ArcGIS.Analyst3D.IBasicScene2 basicScene2 = (ESRI.ArcGIS.Analyst3D.IBasicScene2)globe; // Explicit Cast

  ESRI.ArcGIS.Animation.IAnimationExtension animationExtension = basicScene2.AnimationExtension;
  ESRI.ArcGIS.Animation.IAGAnimationEnvironment AGAnimationEnvironment = basicScene2.AnimationExtension.AnimationEnvironment;

  // Create an instance of videoexporter
  ESRI.ArcGIS.Animation.IVideoExporter videoExporter = new ESRI.ArcGIS.Animation.AnimationExporterAVIClass();

  // Get statusbar from application

  videoExporter.ExportFileName = exportFileName;
  videoExporter.CodecCode = "CVID";
  animationExtension.AnimationEnvironment.AnimationDuration = duration;

  videoExporter.ExportAnimation(animationExtension.AnimationTracks, animationExtension.AnimationEnvironment, null);
}
[Visual Basic .NET]

'''<summary>Exports the current animation in globe to an AVI file.</summary>
''' 
'''<param name="globe">An IGlobe interface</param>
'''<param name="exportFileName">A System.String that is the path and filename of the AVI file to be exported. Example: ex: "C:\temp\myanimation.avi"</param>
'''<param name="duration">A System.Double that is the length (or duration) in seconds of the AVI movie. Example: 30</param>
'''  
'''<remarks></remarks>
Public Sub CreateAnimationAVI(ByVal globe As ESRI.ArcGIS.GlobeCore.IGlobe, ByVal exportFileName As System.String, ByVal duration As System.Double)

  ' Find the animation extension
  Dim basicScene2 As ESRI.ArcGIS.Analyst3D.IBasicScene2 = CType(globe, ESRI.ArcGIS.Analyst3D.IBasicScene2) ' Explicit Cast

  Dim animationExtension As ESRI.ArcGIS.Animation.IAnimationExtension = basicScene2.AnimationExtension
  Dim AGAnimationEnvironment As ESRI.ArcGIS.Animation.IAGAnimationEnvironment = basicScene2.AnimationExtension.AnimationEnvironment

  ' Create an instance of videoexporter
  Dim videoExporter As ESRI.ArcGIS.Animation.IVideoExporter = New ESRI.ArcGIS.Animation.AnimationExporterAVIClass

  ' Get statusbar from application
  videoExporter.ExportFileName = exportFileName
  videoExporter.CodecCode = "CVID"
  animationExtension.AnimationEnvironment.AnimationDuration = duration

  videoExporter.ExportAnimation(animationExtension.AnimationTracks, animationExtension.AnimationEnvironment, Nothing)

End Sub


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.3DAnalyst
  • ESRI.ArcGIS.Animation
  • ESRI.ArcGIS.Display
  • ESRI.ArcGIS.GlobeCore
  • ESRI.ArcGIS.System