{
var animation = mapView.Map.Animation;
var duration = animation.Duration;
if (duration == TimeSpan.Zero)
{
return;
}
var factor = length.TotalSeconds / duration.TotalSeconds;
animation.ScaleDuration(factor);
}
{
var animation = mapView.Map.Animation;
var duration = animation.Duration;
if (duration == TimeSpan.Zero || duration <= afterTime)
{
// Nothing to scale, leave
}
var factor = length.TotalSeconds / (duration.TotalSeconds - afterTime.TotalSeconds);
animation.ScaleDuration(afterTime, duration, factor);
}
{
var animation = mapView.Map.Animation;
var cameraTrack = animation.Tracks.OfType<CameraTrack>().First(); //There will always be only 1 CameraTrack in the animation.
var result = cameraTrack.Keyframes.OfType<CameraKeyframe>().ToList();
//Use the camera keyframes (if any)
}
{
//Return the collection representing the camera for each frame in animation.
await QueuedTask.Run(() =>
{
var animation = mapView.Map.Animation;
var cameras = new List<Camera>();
//We will use ticks here rather than milliseconds to get the highest precision possible.
var ticksPerFrame = Convert.ToInt64(animation.Duration.Ticks / (animation.NumberOfFrames - 1));
for (int i = 0; i < animation.NumberOfFrames; i++)
{
var time = TimeSpan.FromTicks(i * ticksPerFrame);
//Because of rounding for ticks the last calculated time may be greater than the duration.
if (time > animation.Duration)
{
time = animation.Duration;
}
cameras.Add(mapView.Animation.GetCameraAtTime(time));
}
// Use cameras
});
}
{
//Return the collection representing the map time for each frame in animation.
await QueuedTask.Run(() =>
{
var animation = mapView.Map.Animation;
var timeRanges = new List<TimeRange>();
//We will use ticks here rather than milliseconds to get the highest precision possible.
var ticksPerFrame = Convert.ToInt64(animation.Duration.Ticks / (animation.NumberOfFrames - 1));
for (int i = 0; i < animation.NumberOfFrames; i++)
{
var time = TimeSpan.FromTicks(i * ticksPerFrame);
//Because of rounding for ticks the last calculated time may be greater than the duration.
if (time > animation.Duration)
{
time = animation.Duration;
}
timeRanges.Add(mapView.Animation.GetCurrentTimeAtTime(time));
}
// Use timeRanges;
});
}
{
//Return the collection representing the map time for each frame in animation.
await QueuedTask.Run(() =>
{
var animation = mapView.Map.Animation;
var ranges = new List<ArcGIS.Desktop.Mapping.Range>();
//We will use ticks here rather than milliseconds to get the highest precision possible.
var ticksPerFrame = Convert.ToInt64(animation.Duration.Ticks / (animation.NumberOfFrames - 1));
for (int i = 0; i < animation.NumberOfFrames; i++)
{
var time = TimeSpan.FromTicks(i * ticksPerFrame);
//Because of rounding for ticks the last calculated time may be greeting than the duration.
if (time > animation.Duration)
{
time = animation.Duration;
}
ranges.Add(mapView.Animation.GetCurrentRangeAtTime(time));
}
// Use ranges
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)