WhirlyGlobeViewControllerAnimationDelegate
Objective-C
@protocol WhirlyGlobeViewControllerAnimationDelegate <NSObject>
Swift
protocol WhirlyGlobeViewControllerAnimationDelegate : NSObjectProtocol
An animation delegate that can be set on a WhirlyGlobeViewController to control the view over time.
Filling out these methods will get you animation callbacks at the proper time to control position, heading, tilt, and height on a frame basis.
You pass the resulting object in to
-
This method is called when the animation starts.
At the animation start we collect up the various parameters of the current visual view state and pas them in via the startState. You probably want to keep track of this for later.
Declaration
Objective-C
- (void)globeViewController:(WhirlyGlobeViewController *_Nonnull)viewC startState:(WhirlyGlobeViewControllerAnimationState *_Nonnull) startState startTime:(NSTimeInterval)startTime endTime:(NSTimeInterval)endTime;Swift
func globeViewController(_ viewC: WhirlyGlobeViewController, start startState: WhirlyGlobeViewControllerAnimationState, startTime: TimeInterval, endTime: TimeInterval)Parameters
viewCThe view controller doing the animation.
startStateThe starting point for the visual view animation. Cache this somewhere for your own interpolation.
startTimeWhen the animation starts (e.g. now)
endTimeWhen the animation ends. This is an absolute value.
-
This method is called at the beginning of every frame draw to position the viewer.
This is the method that does all the work. You need to fill out the returned WhirlyGlobeViewControllerAnimationState according to whatever interpolation your'e doing based on the currentTime.
Declaration
Objective-C
- (nonnull WhirlyGlobeViewControllerAnimationState *) globeViewController:(WhirlyGlobeViewController *_Nonnull)viewC stateForTime:(NSTimeInterval)currentTime;Swift
func globeViewController(_ viewC: WhirlyGlobeViewController, stateForTime currentTime: TimeInterval) -> WhirlyGlobeViewControllerAnimationStateParameters
viewCThe view controller doing the animation.
currentTimeThe time for this frame. Use this rather than calculating the time yourself.
Return Value
The WhirlyGlobeViewControllerAnimationState expressing where you want the viewer to be and where they are looking.
-
This method is called at the end of the animation.
The globe view controller calls this method when the animation is finished. Do your cleanup here if need be.
Declaration
Objective-C
- (void)globeViewControllerDidFinishAnimation: (WhirlyGlobeViewController *_Nonnull)viewC;Swift
optional func globeViewControllerDidFinishAnimation(_ viewC: WhirlyGlobeViewController)Parameters
viewCThe globe view controller.
WhirlyGlobeViewControllerAnimationDelegate Protocol Reference