The keyframe for globe layer animation.
Product Availability
Supported Platforms
Interfaces
Interfaces | Description |
---|---|
IAGKeyframe (esriAnimation) | Provides access to keyframes of animated objects. |
IClone (esriSystem) | Provides access to members that control cloning of objects. |
IKeyframe (esri3DAnalyst) | Provides access to keyframe of animated objects. |
Remarks
GlobeCameraKeyframe coclass is used for creating Globe Layer animations. This coclass manages the properties and methods that are applicable to a globe layer keyframe. There are 2 globe layer properties - Visibility and Transparency, that can be used in a globe layer animation through its IKeyframe interface.
The following code shows how to create a Globe Layer animation to make a layer transparent by adding GlobeLayerKeyframes to an animation track. Note: To use the code below, you have to reference ESRI's Animation library.
private void GlobeLayerKeyframes_Transparency(ESRI.ArcGIS.GlobeCore.IGlobe globe, ESRI.ArcGIS.Carto.ILayer layer)
{
ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay = globe.GlobeDisplay;
ESRI.ArcGIS.Analyst3D.IScene scene = globeDisplay.Scene;
// Get a handle to the animation extension
ESRI.ArcGIS.Analyst3D.IBasicScene2 basicScene2 = (ESRI.ArcGIS.Analyst3D.IBasicScene2)scene; // Explicit Cast
ESRI.ArcGIS.Animation.IAnimationExtension animationExtension = basicScene2.AnimationExtension;
// create an animation track
ESRI.ArcGIS.Animation.IAGAnimationTrack animationTrack = new AnimationTrackClass();
ESRI.ArcGIS.Animation.IAGAnimationTrackKeyframes animationTrackKeyframes = (ESRI.ArcGIS.Animation.IAGAnimationTrackKeyframes)animationTrack; //Explicit cast
// set the type before adding keyframes
ESRI.ArcGIS.Animation.IAGAnimationType animationType = new AnimationTypeGlobeLayerClass();
animationTrack.AnimationType = animationType;
// create four keyframes and add them to the track
ESRI.ArcGIS.Animation.IAGKeyframe keyframe;
int nKeyframes = 4;
int numKeyframe;
for (numKeyframe = 0; numKeyframe <= nKeyframes - 1; numKeyframe++)
{
keyframe = new GlobeLayerKeyframeClass();
animationTrackKeyframes.InsertKeyframe(keyframe, -1);
keyframe.TimeStamp = 1.0 * numKeyframe / (nKeyframes - 1); // set transparency values
keyframe.set_PropertyValue(0, true); // set visibility
keyframe.set_PropertyValue(1, 100 * numKeyframe / (nKeyframes - 1)); // set transparency
}
// set active properties in the track
ILongArray longArrayCls = new LongArrayClass();
longArrayCls.Add (0);
longArrayCls.Add (1);
animationTrackKeyframes.ActiveProperties = longArrayCls;
// attach the track to the first layer in TOC
animationTrack.AttachObject (layer);
// animation loop
ESRI.ArcGIS.Animation.IAGAnimationContainer AGAnimationContainer = animationExtension.AnimationTracks.AnimationObjectContainer;
double time;
double iteration;
for (iteration = 0; iteration < 500; iteration++)
{
time = iteration / 500;
// interpolate by using track
animationTrack.InterpolateObjectProperties(AGAnimationContainer, time);
globeDisplay.RefreshViewers();
}
}