// Copyright (c) 2022 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
// Use of this source is governed by Apache-2.0 License that can be found
// in the LICENSE file.
/// This enum describes the direction of the animation when in `Running` state.
/// This enum describes the state of the animation.
/// The `AbstractAnimation` trait is the base of all animations.
///
/// The trait defines the functions for the functionality shared by all animations.
///
/// By implementing this trait, you can create custom animations that plug into
/// the rest of the animation framework.
///
/// The progress of an animation is given by its current time (`current_loop_time()`),
/// which is measured in milliseconds from the start of the animation (0) to its end (`duration()`).
/// The value is updated automatically while the animation is running.
/// It can also be set directly with `set_current_time()`.
/// At any point an animation is in one of three states: Running, Stopped, or Paused.
/// The current state can be changed by calling `start()`, `stop()`, `pause()`, or `resume()`.
/// An animation will always reset its current time when it is started.
/// If paused, it will continue with the same current time when resumed.
/// When an animation is stopped, it cannot be resumed, but will keep its current time
/// (until started again).
///
/// An animation can loop any number of times by setting the `loop_count` property.
/// When an animation's current time reaches its `duration()`, it will reset the current time
/// and keep running. A loop count of 1 (the default value) means that the animation will
/// run one time. Note that a duration of -1 means that the animation will run until stopped;
/// the current time will increase indefinitely. When the current time equals `duration()`
/// and the animation is in its final loop, the `Stopped` state is entered.
///
/// The `duration()` function lets you report a duration for the animation (as discussed above).
/// The animation framework calls `update_current_time()` when current time has changed.
/// By implementing this function, you can track the animation progress. Note that neither
/// the interval between calls nor the number of calls to this function are defined;
/// though, it will normally be 60 updates per second.
///
/// By implementing `update_state()`, you can track the animation's state changes,
/// which is particularly useful for animations that are not driven by time.