pub struct Animation {
pub fps: f32,
pub object_name: String,
pub property_name: String,
pub frame_start: u32,
pub frame_end: u32,
pub frame_values: Vec<f32>,
}Expand description
An animation for a single property of a single object.
Fields§
§fps: f32The number of frames per second. Same as PropertiesAnimation::fps
object_name: StringThe unique name of the object.
property_name: StringThe name of the property.
frame_start: u32The first frame of the animation.
frame_end: u32The last frame of the animation (including).
frame_values: Vec<f32>The list of values for each frame starting with frame_start and ending with frame_end.
Implementations§
Source§impl Animation
impl Animation
Sourcepub fn get_animation_value_at_time(&self, elapsed_time: f32) -> f32
pub fn get_animation_value_at_time(&self, elapsed_time: f32) -> f32
Returns the value of the animation at the given time (in seconds).
Sourcepub fn get_value_at_exact_frame(&self, frame: u32) -> f32
pub fn get_value_at_exact_frame(&self, frame: u32) -> f32
Returns the value of the animation at the given frame. If a frame is before the start of the animation, the first value is returned. If a frame is after the end of the animation, the last value is returned.
Sourcepub fn get_interpolated_value_at_frame(&self, frame: f32) -> f32
pub fn get_interpolated_value_at_frame(&self, frame: f32) -> f32
Returns the value of the animation at the given frame. If a frame is before the start of the animation, the first value is returned. If a frame is after the end of the animation, the last value is returned. If a frame is between two frames (i.e. is not an integer), the value is linearly interpolated.