Exploding (moving) layers animation sample


This command will build, run, and optionally persist an animation which moves selected layers from their default position to some offset location and back to the original location. The Equal Spaced option will move the layers selected to an equally spaced location around a 360 degree offset, while the Random Spaced option will choose random postitions.

To do this, for each designated layer, three layer keyframes will be created- one at the original location, one at the offset location, and one back at the original location. Then, using the IKeyframe::Interpolate method, an animation can be played over the desiginated time. Optionally, a collection of animation tracks of these keyframes combinations can be added to the scene for re-use.

Individual properties of a keyframe can be set directly depending on the property type (Long, Integer, Point, Extent, Double, RGBColor, or Boolean), and the index of the property.

For example,
pK.PropertyValueDouble(2) = 90
sets the azimuth (property 2) of the 'pK' keyframe variable to 90.

How to use:

    Steps for adding a command/tool from a DLL:

  1. Register the DLL: sxExplodeLayersAnimation.dll. You can register a DLL on Windows by typing in the Start Menu\Run dialog box 'regsvr32 ' and the path to the dll file.
  2. In the Customize dialog, click on 'Add from file', and browse to select 'sxExplodeLayersAnimation.dll'.
  3. Under the Commands tab, find the '3D Analyst Developer Samples (Animation)' and drag the 'Explode Layers' command onto a toolbar or menu. Dismiss the Customize dialog.

    Using the Tool:

  1. Start ArcScene and load the layers of interest. Run the 'Explode' command.
  2. Choose the layers to activate for this command, and the movement time for the layers- either equal spaced, or random. Set the radius and offset for the target destinations of the selected layers.
  3. Next, set the speed for the preview playback. This setting will not affect any tracks which are added to the scene animation collection, as scene animation track speed is controlled by the play controls. This setting, however, is proportional to the number of steps used in playing back the animation via the 'Apply' command or on command exit, and therefore, the speed. A speed setting of 0 will produce no immediate playback.


Requires: An ArcScene session with layers of interest loaded.

Difficulty: Beginner

Visual Basic
File Description
basExplodeLayersAnimation.bas A module used to gather the parameters for, and run the appropriate animation creation commands.
ExplodeLayersAnimCommand.cls ICommand implementation for the tool.
frmExplodeLayersAnim.frm Main dialog for the tool.
basAnimation.bas and other 3D Analyst Developer Sample utilties This project also references shared code located in Visual Basic code modules. To compile this project, these files are necessary in the location: '<ARCGIS INSTALL PATH > \ArcObjects Developer Kit\Samples\3D Analyst\Utilities\ '. This example especially uses the basAnimation module in this set of files, for instance.

Key CoClasses: AnimationTypeCamera
Key Interfaces: IAnimationTrack, IKeyframe
Key Members: IAnimationTrack::InterpolateObjectProperties