rusty_spine/
animation.rs

1use crate::{
2    c::spAnimation,
3    c_interface::{NewFromPtr, SyncPtr},
4};
5
6/// Stores timelines for animating a skeleton.
7///
8/// [Spine API Reference](http://esotericsoftware.com/spine-api-reference#Animation)
9#[derive(Debug)]
10pub struct Animation {
11    c_animation: SyncPtr<spAnimation>,
12}
13
14impl NewFromPtr<spAnimation> for Animation {
15    unsafe fn new_from_ptr(c_animation: *mut spAnimation) -> Self {
16        Self {
17            c_animation: SyncPtr(c_animation),
18        }
19    }
20}
21
22impl Animation {
23    c_accessor_string!(
24        /// The animation's name, which is unique across all animations in the skeleton.
25        name,
26        name
27    );
28    c_accessor!(
29        /// The duration of the animation in seconds, which is usually the highest time of all
30        /// frames in the timeline. The duration is used to know when it has completed and when it
31        /// should loop back to the start.
32        duration,
33        duration,
34        f32
35    );
36    c_ptr!(c_animation, spAnimation);
37    // TODO: timeline accessors
38}