aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs
index b5a2eaef532..55ea436b5da 100644
--- a/components/style/properties/helpers/animated_properties.mako.rs
+++ b/components/style/properties/helpers/animated_properties.mako.rs
@@ -664,6 +664,10 @@ fn interpolate_transform_list(from_list: &[TransformOperation],
}
(&TransformOperation::Rotate(fx, fy, fz, fa),
&TransformOperation::Rotate(tx, ty, tz, ta)) => {
+ let norm_f = ((fx * fx) + (fy * fy) + (fz * fz)).sqrt();
+ let norm_t = ((tx * tx) + (ty * ty) + (tz * tz)).sqrt();
+ let (fx, fy, fz) = (fx / norm_f, fy / norm_f, fz / norm_f);
+ let (tx, ty, tz) = (tx / norm_t, ty / norm_t, tz / norm_t);
if fx == tx && fy == ty && fz == tz {
let ia = fa.interpolate(&ta, time).unwrap();
result.push(TransformOperation::Rotate(fx, fy, fz, ia));