This sample illustrates how to load an ArcMap animation file and play the animation. It assumes that the user has the map data used to create the animation file.
How to use
- Open ArcMap and add the layer(s) that were used to create an animation file to the ArcMap TOC
- Copy and paste the following code into the VB editor in ArcMap, and change the path and name of the animation file to your own path;
- Make sure that "ESRI Animation Object Library" and "ESRI AnimationUI Object Library" are checked in the References dialog box of the VBA project;
- Run the macro "Map_Load_Animation";
- Make sure ArcMap is visible, so that you can see the playing of the animation.
Public Sub Map_Load_Animation()
'Find the animation extension
Dim pUID As New UID
pUID.Value = "esriAnimation.AnimationExtension"
Dim pAnimExt As IAnimationExtension
Set pAnimExt = Application.FindExtensionByCLSID(pUID)
'Get the animation track container from the animation extension
Dim pAnimTracks As IAGAnimationTracks
Set pAnimTracks = pAnimExt.AnimationTracks
'Load the animation file using the AGAnimationUtils object
Dim pAGAnimUtils As IAGAnimationUtils
Set pAGAnimUtils = New AGAnimationUtils
pAGAnimUtils.LoadAnimationFile pAnimExt.AnimationTracks.AnimationObjectContainer, _
"C:\temp\agAnimFile.ama"
'Play the animation using the IAGAnimationPlayer interface
Dim pAGAnimPlayer As IAGAnimationPlayer
Set pAGAnimPlayer = pAGAnimUtils 'QI
pAGAnimPlayer.PlayAnimation pAnimTracks, pAnimExt.AnimationEnvironment, Application.StatusBar
End Sub