Parameters
- time
- The time at which to return the camera.
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
public Task<List<Camera>> GetInterpolatedCameras() { //Return the collection representing the camera for each frame in animation. return QueuedTask.Run(() => { var mapView = MapView.Active; if (mapView != null || mapView.Animation == null) return null; 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 greating than the duration. if (time > animation.Duration) time = animation.Duration; cameras.Add(mapView.Animation.GetCameraAtTime(time)); } return cameras; }); }
Target Platforms: Windows 11, Windows 10