Add repeat, repeat_forever, and auto_reverse to Animation
This commit is contained in:
parent
23d42d2827
commit
ae35992048
1 changed files with 20 additions and 0 deletions
|
|
@ -67,6 +67,26 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Makes the [`Animation`] repeat a given amount of times.
|
||||||
|
///
|
||||||
|
/// Providing 1 repetition plays the animation twice in total.
|
||||||
|
pub fn repeat(mut self, repetitions: u32) -> Self {
|
||||||
|
self.raw = self.raw.repeat(repetitions);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Makes the [`Animation`] repeat forever.
|
||||||
|
pub fn repeat_forever(mut self) -> Self {
|
||||||
|
self.raw = self.raw.repeat_forever();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Makes the [`Animation`] automatically reverse when repeating.
|
||||||
|
pub fn auto_reverse(mut self) -> Self {
|
||||||
|
self.raw = self.raw.auto_reverse();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Transitions the [`Animation`] from its current state to the given new state.
|
/// Transitions the [`Animation`] from its current state to the given new state.
|
||||||
pub fn go(mut self, new_state: T) -> Self {
|
pub fn go(mut self, new_state: T) -> Self {
|
||||||
self.go_mut(new_state);
|
self.go_mut(new_state);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue