mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 12:17:52 +00:00
LibWeb: Discard inaccuracies when interpolating rotate
This commit is contained in:
parent
d6761ab251
commit
ed6cac89b9
Notes:
github-actions[bot]
2025-08-12 13:36:13 +00:00
Author: https://github.com/Calme1709
Commit: ed6cac89b9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5833
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 8 additions and 1 deletions
|
@ -360,8 +360,15 @@ static FloatVector4 slerp(FloatVector4 const& from, FloatVector4 const& to, floa
|
|||
|
||||
auto theta = acosf(product);
|
||||
auto w = sinf(delta * theta) / sqrtf(1 - (product * product));
|
||||
auto from_multiplier = cosf(delta * theta) - (product * w);
|
||||
|
||||
return from * (cosf(delta * theta) - (product * w)) + to * w;
|
||||
if (abs(w) < AK::NumericLimits<float>::epsilon())
|
||||
return from * from_multiplier;
|
||||
|
||||
if (abs(from_multiplier) < AK::NumericLimits<float>::epsilon())
|
||||
return to * w;
|
||||
|
||||
return from * from_multiplier + to * w;
|
||||
}
|
||||
|
||||
static RefPtr<StyleValue const> interpolate_rotate(DOM::Element& element, CalculationContext calculation_context, StyleValue const& a_from, StyleValue const& a_to, float delta, AllowDiscrete allow_discrete)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue