Skip to content

Commit

Permalink
Fix up some field accessors in the animations module
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkleiny committed Apr 23, 2024
1 parent 0fe6968 commit a4535d8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions modules/graphics/src/animations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ pub struct AnimationTree<T = ()> {

/// A single animation state in an animation tree.
pub struct AnimationState<T> {
name: StringName,
clip: AnimationClip,
transitions: Vec<AnimationTransition<T>>,
time_elapsed: TimeSpan,
speed: f32,
pub name: StringName,
pub clip: AnimationClip,
pub transitions: Vec<AnimationTransition<T>>,
pub time_elapsed: TimeSpan,
pub speed: f32,
}

/// A condition that must be met for a transition to occur.
type Condition<T> = Box<dyn Fn(&AnimationState<T>, &T) -> bool>;

/// A transition between two animation states.
pub struct AnimationTransition<T> {
target: StringName,
condition: Condition<T>,
pub target: StringName,
pub condition: Condition<T>,
}

/// A single clip of animation data.
#[derive(Default)]
pub struct AnimationClip {
duration: TimeSpan,
tracks: Vec<AnimationTrack>,
pub duration: TimeSpan,
pub tracks: Vec<AnimationTrack>,
}

/// A single track of animation data.
Expand All @@ -58,8 +58,8 @@ pub type AnimationTrackData<T> = Vec<AnimationKeyFrame<T>>;
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AnimationKeyFrame<T> {
time: f32,
value: T,
pub time: f32,
pub value: T,
}

impl<T> AnimationTree<T> {
Expand Down

0 comments on commit a4535d8

Please sign in to comment.