Skip to content

Commit

Permalink
fix animation reversing by removing undocumented and buggy "reverse_a…
Browse files Browse the repository at this point in the history
…djustment_factor"
  • Loading branch information
ChrisFloofyKitsune committed Jun 8, 2024
1 parent 60ea18e commit 01bb77e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
4 changes: 1 addition & 3 deletions Include/RmlUi/Core/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ struct Transition {
Tween tween;
float duration = 0.0f;
float delay = 0.0f;
float reverse_adjustment_factor = 0.0f;
};

struct TransitionList {
Expand All @@ -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)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/Core/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
Expand Down
13 changes: 0 additions & 13 deletions Source/Core/PropertyParserAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/TypeConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ bool TypeConverter<TransitionList, String>::Convert(const TransitionList& src, S
dest += tmp + "s ";
if (t.delay > 0.0f && TypeConverter<float, String>::Convert(t.delay, tmp))
dest += tmp + "s ";
if (t.reverse_adjustment_factor > 0.0f && TypeConverter<float, String>::Convert(t.reverse_adjustment_factor, tmp))
dest += tmp + ' ';
if (dest.size() > 0)
dest.resize(dest.size() - 1);
if (i != src.transitions.size() - 1)
Expand Down

0 comments on commit 01bb77e

Please sign in to comment.