summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-01-28 03:24:48 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-01-28 03:24:48 +0100
commitae35992048e7717a6e4308841859bfb6c0a7d51c (patch)
tree6bc32442b690a1cfa5c5d34142ca1636e317d145 /core
parent23d42d2827a68468bc520440c6396eb114d793bc (diff)
downloadiced-ae35992048e7717a6e4308841859bfb6c0a7d51c.tar.gz
iced-ae35992048e7717a6e4308841859bfb6c0a7d51c.tar.bz2
iced-ae35992048e7717a6e4308841859bfb6c0a7d51c.zip
Add `repeat`, `repeat_forever`, and `auto_reverse` to `Animation`
Diffstat (limited to 'core')
-rw-r--r--core/src/animation.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/src/animation.rs b/core/src/animation.rs
index 5ff31544..258fd084 100644
--- a/core/src/animation.rs
+++ b/core/src/animation.rs
@@ -67,6 +67,26 @@ where
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.
pub fn go(mut self, new_state: T) -> Self {
self.go_mut(new_state);