From 8a04f188117b46475ddd55966f5f7d069b61a01c Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Tue, 27 Aug 2024 11:54:29 -0600 Subject: [PATCH] spin: Add spin rotations option This option sets the number of spin rotations. Negative values will reverse the direction. --- metadata/animate.xml | 5 +++++ plugins/animate/spin.hpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/metadata/animate.xml b/metadata/animate.xml index 35ab3e938..45f2f7cb4 100644 --- a/metadata/animate.xml +++ b/metadata/animate.xml @@ -164,5 +164,10 @@ <_long>Sets the duration for the spin animation in milliseconds. 250ms linear + diff --git a/plugins/animate/spin.hpp b/plugins/animate/spin.hpp index b4220871b..f9e8c968a 100644 --- a/plugins/animate/spin.hpp +++ b/plugins/animate/spin.hpp @@ -32,6 +32,7 @@ wf::option_wrapper_t spin_duration{"animate/spin_duration"}; +wf::option_wrapper_t spin_rotations{"animate/spin_rotations"}; namespace wf { @@ -77,7 +78,7 @@ class spin_animation : public animation_base ->get_transformer(spin_transformer_name); auto progress = this->progression.progress(); transform->alpha = progress; - transform->angle = progress * M_PI * 4.0; + transform->angle = progress * M_PI * 2.0 * int(spin_rotations); transform->scale_x = 0.01 + progress * 0.99; transform->scale_y = 0.01 + progress * 0.99;