From 01bb77e3504bd55213996a966c7947e8bfba3824 Mon Sep 17 00:00:00 2001 From: ChrisFloofyKitsune Date: Sat, 8 Jun 2024 15:09:14 -0600 Subject: [PATCH] fix animation reversing by removing undocumented and buggy "reverse_adjustment_factor" --- Include/RmlUi/Core/Animation.h | 4 +--- Source/Core/Element.cpp | 4 +--- Source/Core/PropertyParserAnimation.cpp | 13 ------------- Source/Core/TypeConverter.cpp | 2 -- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/Include/RmlUi/Core/Animation.h b/Include/RmlUi/Core/Animation.h index 15e784899..4a7c3a588 100644 --- a/Include/RmlUi/Core/Animation.h +++ b/Include/RmlUi/Core/Animation.h @@ -51,7 +51,6 @@ struct Transition { Tween tween; float duration = 0.0f; float delay = 0.0f; - float reverse_adjustment_factor = 0.0f; }; struct TransitionList { @@ -74,8 +73,7 @@ inline bool operator!=(const Animation& a, const Animation& b) } inline bool operator==(const Transition& a, const Transition& b) { - return a.id == b.id && a.tween == b.tween && a.duration == b.duration && a.delay == b.delay && - a.reverse_adjustment_factor == b.reverse_adjustment_factor; + return a.id == b.id && a.tween == b.tween && a.duration == b.duration && a.delay == b.delay; } inline bool operator!=(const Transition& a, const Transition& b) { diff --git a/Source/Core/Element.cpp b/Source/Core/Element.cpp index 07c6173ad..5912e864c 100644 --- a/Source/Core/Element.cpp +++ b/Source/Core/Element.cpp @@ -2534,9 +2534,7 @@ bool Element::StartTransition(const Transition& transition, const Property& star else { // Compress the duration based on the progress of the current animation - float f = it->GetInterpolationFactor(); - f = 1.0f - (1.0f - f) * transition.reverse_adjustment_factor; - duration = duration * f; + duration *= it->GetInterpolationFactor(); // Replace old transition *it = ElementAnimation{transition.id, ElementAnimationOrigin::Transition, start_value, *this, start_time, 0.0f, 1, false}; } diff --git a/Source/Core/PropertyParserAnimation.cpp b/Source/Core/PropertyParserAnimation.cpp index d9faaed35..85a692cff 100644 --- a/Source/Core/PropertyParserAnimation.cpp +++ b/Source/Core/PropertyParserAnimation.cpp @@ -279,17 +279,6 @@ static bool ParseTransition(Property& property, const StringList& transition_val else return false; } - else - { - // No 's' unit means reverse adjustment factor was found - if (!reverse_adjustment_factor_found) - { - reverse_adjustment_factor_found = true; - transition.reverse_adjustment_factor = number; - } - else - return false; - } } else { @@ -317,8 +306,6 @@ static bool ParseTransition(Property& property, const StringList& transition_val if ((transition_list.all && !target_property_ids.Empty()) // || (!transition_list.all && target_property_ids.Empty()) // || transition.duration <= 0.0f // - || transition.reverse_adjustment_factor < 0.0f // - || transition.reverse_adjustment_factor > 1.0f // ) { return false; diff --git a/Source/Core/TypeConverter.cpp b/Source/Core/TypeConverter.cpp index 24d1b0267..e43e9cbd3 100644 --- a/Source/Core/TypeConverter.cpp +++ b/Source/Core/TypeConverter.cpp @@ -123,8 +123,6 @@ bool TypeConverter::Convert(const TransitionList& src, S dest += tmp + "s "; if (t.delay > 0.0f && TypeConverter::Convert(t.delay, tmp)) dest += tmp + "s "; - if (t.reverse_adjustment_factor > 0.0f && TypeConverter::Convert(t.reverse_adjustment_factor, tmp)) - dest += tmp + ' '; if (dest.size() > 0) dest.resize(dest.size() - 1); if (i != src.transitions.size() - 1)