AWFAnimation

Objective-C

@interface AWFAnimation : NSObject

Swift

class AWFAnimation : NSObject

An AWFAnimation object provides the core functionality necessary for a single time-based animation. The animation is defined by a specified start and end date.

  • Starting date for the animation.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSDate *startDate;

    Swift

    var startDate: Date? { get set }
  • Ending date for the animation.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSDate *endDate;

    Swift

    var endDate: Date? { get set }
  • Total time in seconds for the animation to complete before restarting from the beginning. The animation speed will be calcuated based on this value, so a longer duration will result in a slower animation speed.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat duration;

    Swift

    var duration: CGFloat { get set }
  • Delay duration to hold the last interval of the animation before restarting from the beginning, in seconds.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat endDelay;

    Swift

    var endDelay: CGFloat { get set }
  • Total time, in seconds, of the animation based on the start and end dates.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval totalTime;

    Swift

    var totalTime: TimeInterval { get }
  • Date of the animation’s current position.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *currentTime;

    Swift

    var currentTime: Date? { get }
  • A Boolean value indicating if this animation contains a future time period.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL containsFutureTime;

    Swift

    var containsFutureTime: Bool { get }
  • The parent timeline animation controlling the animation, if any.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) AWFAnimationTimeline *timeline;

    Swift

    weak var timeline: AWFAnimationTimeline? { get set }
  • The coordinate bounds for the current data being animated.

    Declaration

    Objective-C

    @property (nonatomic, strong) AWFMapCoordinateBounds *_Nonnull currentBoundsForData;

    Swift

    var currentBoundsForData: AWFMapCoordinateBounds { get set }
  • Returns whether the animation is currently animating.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isAnimating) BOOL animating;

    Swift

    var isAnimating: Bool { get }
  • Returns whether the animation is currently loading data to be animated.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isLoading) BOOL loading;

    Swift

    var isLoading: Bool { get }
  • Returns whether the animation has loaded all necessary data and is ready to begin animating.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isReady) BOOL ready;

    Swift

    var isReady: Bool { get }
  • Returns whether the animation has played at least once through the end of its timeline.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=hasPlayed) BOOL played;

    Swift

    var hasPlayed: Bool { get }
  • Returns whether the animation is currently enabled. When the value is NO, the animation will not perform playback individually nor within the context of a grouped timeline animation.

    Declaration

    Objective-C

    @property (nonatomic, getter=isEnabled) BOOL enabled;

    Swift

    var isEnabled: Bool { get set }
  • The object that acts as the data source of the receiving animation. * The data source must adopt an {@link AWFAnimationDataSource} protocol.

    Declaration

    Objective-C

    @property (nonatomic, nullable) id<AWFAnimationDataSource> dataSource;

    Swift

    unowned(unsafe) var dataSource: AWFAnimationDataSource? { get set }
  • The object that acts as the delegate of the receiving animation. * The delegate must adopt the AWFAnimationDelegate protocol.

    Declaration

    Objective-C

    @property (nonatomic, nullable) id<AWFAnimationDelegate> delegate;

    Swift

    unowned(unsafe) var delegate: AWFAnimationDelegate? { get set }
  • Created a new animation with specific starting and ending dates. *

    Declaration

    Objective-C

    - (nonnull instancetype)initWithStartDate:(nonnull NSDate *)startDate
                                      endDate:(nonnull NSDate *)endDate;

    Swift

    init(start startDate: Date, end endDate: Date)

    Parameters

    startDate

    The date when the animation should start

    endDate

    The date when the animation should end *

    Return Value

    An animation instance with the defined date range.

  • Creates a new animation whose start date is defined by the specified time interval before the current time/date. * Using this selector will automatically set the toTime to the current date, [NSDate date], and the interval provided will automatically be converted to a negative value to indicate an interval before now. *

    Declaration

    Objective-C

    - (nonnull instancetype)initWithTimeIntervalBeforeNow:
        (NSTimeInterval)intervalBeforeNow;

    Swift

    init(timeIntervalBeforeNow intervalBeforeNow: TimeInterval)

    Parameters

    intervalBeforeNow

    The time interval in seconds before now from which the animation should start *

    Return Value

    An animation instance with the defined date range.

  • Starts the animation if not already animating.

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()
  • Stops the animation if currently animating. * Starting the animation again using start will restart the animation from the beginning.

    Declaration

    Objective-C

    - (void)stop;

    Swift

    func stop()
  • Pauses the animation at the current interval. * Starting the animation again using start will resume the animation from the current interval.

    Declaration

    Objective-C

    - (void)pause;

    Swift

    func pause()
  • Restarts the animation from the beginning.

    Declaration

    Objective-C

    - (void)restart;

    Swift

    func restart()
  • Advances the animation to a relative position in the time interval. * This value provided should be a value from 0 to 1, 0 indicating the beginning of the animation and 1 indicating the end. For example, if you wanted to advance the animation to the midpoint, you would pass a value of 0.5. *

    Declaration

    Objective-C

    - (void)goToPosition:(CGFloat)position;

    Swift

    func go(toPosition position: CGFloat)

    Parameters

    position

    The position to move the animation to as a value from 0 to 1.

  • Advances the animation to a specific time and date in the time interval. * If the provided date is beyond the bounds of the animation, this method will do nothing and a warning will be fired. *

    Declaration

    Objective-C

    - (void)goToTime:(nonnull NSDate *)date;

    Swift

    func go(toTime date: Date)

    Parameters

    date

    The date within the animation range to advance to.

  • Advances the animation to a specific time and date in the time interval with an option to stop playback if the animation is currently playing. *

    Declaration

    Objective-C

    - (void)goToTime:(nonnull NSDate *)date stop:(BOOL)stop;

    Swift

    func go(toTime date: Date, stop: Bool)

    Parameters

    date

    The date within the animation range to advance to.

    stop

    Whether or not the animation should stop playing when the position is changed.

  • Advances the animation to a specific time interval offset, in seconds, from the beginning of the animation. *

    Declaration

    Objective-C

    - (void)goToTimeIntervalWithOffset:(NSTimeInterval)timeOffset;

    Swift

    func goToTimeInterval(withOffset timeOffset: TimeInterval)

    Parameters

    timeOffset

    The time interval offset from the beginning in seconds.

  • Reloads the data that is used for the animation as provided by the data source. * Call this method to reload and prepare the data that is used for this animation, specifically after the data source has loaded or updated the data to be used.

    Declaration

    Objective-C

    - (void)reloadData;

    Swift

    func reloadData()
  • Resets the animation to its original state, removing all cached data that was previously loaded. * Call this method to remove all cached data and force new data to be loaded next time the animation begins playback. Calling this method will stop the animation if it is currently playing.

    Declaration

    Objective-C

    - (void)reset;

    Swift

    func reset()