Creates an animation by interpolating between two keyframes in the globe. The animation makes the Globe layer transparent by interpolating between the keyframes.
[C#]
///<summary>Creates an animation by interpolating between two keyframes in the globe. The animation makes the Globe layer transparent by interpolating between the keyframes.</summary>
///
///<param name="globe">An IGlobe interface</param>
///<param name="layer">An ILayer interface</param>
///
///<remarks></remarks>
public void CreateAnimationByInterpolatingBetweenTwoKeyframes(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 agAnimationTrack = new ESRI.ArcGIS.Analyst3D.AnimationTrackClass();
ESRI.ArcGIS.Animation.IAGAnimationTrackKeyframes agAnimationTrackKeyframes = (ESRI.ArcGIS.Animation.IAGAnimationTrackKeyframes)agAnimationTrack; //Explicit cast
// set the type before adding keyframes
ESRI.ArcGIS.Animation.IAGAnimationType agAnimationType = new ESRI.ArcGIS.GlobeCore.AnimationTypeGlobeLayerClass();
agAnimationTrack.AnimationType = agAnimationType;
// create four keyframes and add them to the track
ESRI.ArcGIS.Animation.IAGKeyframe agKeyframe;
System.Int32 nKeyframes = 4;
System.Int32 numKeyframe;
for (numKeyframe = 0; numKeyframe <= nKeyframes - 1; numKeyframe++)
{
agKeyframe = new ESRI.ArcGIS.GlobeCore.GlobeLayerKeyframeClass();
agAnimationTrackKeyframes.InsertKeyframe(agKeyframe, -1);
agKeyframe.TimeStamp = 1.0 * numKeyframe / (nKeyframes - 1); // set transparency values
agKeyframe.set_PropertyValue(0, true); // set visibility
agKeyframe.set_PropertyValue(1, 100 * numKeyframe / (nKeyframes - 1)); // set transparency
}
// set active properties in the track
ESRI.ArcGIS.esriSystem.ILongArray longArray = new ESRI.ArcGIS.esriSystem.LongArrayClass();
longArray.Add(0);
longArray.Add(1);
agAnimationTrackKeyframes.ActiveProperties = (ESRI.ArcGIS.esriSystem.ILongArray)longArray; // Explicit Cast
// attach the track to the first layer in TOC
agAnimationTrack.AttachObject(layer);
// animation loop
ESRI.ArcGIS.Animation.IAGAnimationContainer agAnimationContainer = animationExtension.AnimationTracks.AnimationObjectContainer;
System.Double time;
System.Double iteration;
for (iteration = 0; iteration < 500; iteration++)
{
time = iteration / 500;
// interpolate by using track
agAnimationTrack.InterpolateObjectProperties(agAnimationContainer, time);
globeDisplay.RefreshViewers();
}
}
[Visual Basic .NET]
'''<summary>Creates an animation by interpolating between two keyframes in the globe. The animation makes the Globe layer transparent by interpolating between the keyframes.</summary>
'''
'''<param name="globe">An IGlobe interface</param>
'''<param name="layer">An ILayer interface</param>
'''
'''<remarks></remarks>
Public Sub CreateAnimationByInterpolatingBetweenTwoKeyframes(ByVal globe As ESRI.ArcGIS.GlobeCore.IGlobe, ByVal layer As ESRI.ArcGIS.Carto.ILayer)
Dim globeDisplay As ESRI.ArcGIS.GlobeCore.IGlobeDisplay = globe.GlobeDisplay
Dim scene As ESRI.ArcGIS.Analyst3D.IScene = globeDisplay.Scene
' Get a handle to the animation extension
Dim basicScene2 As ESRI.ArcGIS.Analyst3D.IBasicScene2 = CType(scene, ESRI.ArcGIS.Analyst3D.IBasicScene2) ' Explicit Cast
Dim animationExtension As ESRI.ArcGIS.Animation.IAnimationExtension = basicScene2.AnimationExtension
' create an animation track
Dim agAnimationTrack As ESRI.ArcGIS.Animation.IAGAnimationTrack = New ESRI.ArcGIS.Analyst3D.AnimationTrackClass
Dim agAnimationTrackKeyframes As ESRI.ArcGIS.Animation.IAGAnimationTrackKeyframes = CType(agAnimationTrack, ESRI.ArcGIS.Animation.IAGAnimationTrackKeyframes) ' Explicit Cast
' set the type before adding keyframes
Dim agAnimationType As ESRI.ArcGIS.Animation.IAGAnimationType = New ESRI.ArcGIS.GlobeCore.AnimationTypeGlobeLayerClass
agAnimationTrack.AnimationType = agAnimationType
' create four keyframes and add them to the track
Dim agKeyframe As ESRI.ArcGIS.Animation.IAGKeyframe
Dim nKeyframes As System.Int32 = 4
Dim numKeyframe As System.Int32
For numKeyframe = 0 To nKeyframes - 1
agKeyframe = New ESRI.ArcGIS.GlobeCore.GlobeLayerKeyframeClass
agAnimationTrackKeyframes.InsertKeyframe(agKeyframe, -1)
agKeyframe.TimeStamp = 1 * numKeyframe / (nKeyframes - 1) ' set transparency values
agKeyframe.PropertyValue(0) = True ' set visibility
agKeyframe.PropertyValue(1) = 100 * numKeyframe / (nKeyframes - 1) ' set transparency
Next numKeyframe
' set active properties in the track
Dim longArray As ESRI.ArcGIS.esriSystem.ILongArray = New ESRI.ArcGIS.esriSystem.LongArrayClass
longArray.Add(0)
LongArray.Add(1)
agAnimationTrackKeyframes.ActiveProperties = CType(LongArray, ESRI.ArcGIS.esriSystem.ILongArray) ' Explicit Cast
' attach the track to the first layer in TOC
agAnimationTrack.AttachObject(layer)
Dim agAnimationContainer As ESRI.ArcGIS.Animation.IAGAnimationContainer = animationExtension.AnimationTracks.AnimationObjectContainer
' animation loop
Dim time As System.Double
Dim iteration As System.Double
For iteration = 0 To 500
time = iteration / 500
' interpolate by using track
agAnimationTrack.InterpolateObjectProperties(agAnimationContainer, time)
globeDisplay.RefreshViewers()
Next iteration
End Sub