From e10288ec1ce747cba0f1013faf43667fa3971da8 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 25 Jun 2016 22:35:20 -0700 Subject: [PATCH] Linearly interpolate rotation angles with equal direction Fixes #11808, but still leaves matrix interpolation open. --- .../properties/helpers/animated_properties.mako.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 3b75b4ee07b3..b5a2eaef5327 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -663,9 +663,14 @@ fn interpolate_transform_list(from_list: &[TransformOperation], result.push(TransformOperation::Scale(ix, iy, iz)); } (&TransformOperation::Rotate(fx, fy, fz, fa), - &TransformOperation::Rotate(_tx, _ty, _tz, _ta)) => { - // TODO(gw): Implement matrix decomposition and interpolation - result.push(TransformOperation::Rotate(fx, fy, fz, fa)); + &TransformOperation::Rotate(tx, ty, tz, ta)) => { + if fx == tx && fy == ty && fz == tz { + let ia = fa.interpolate(&ta, time).unwrap(); + result.push(TransformOperation::Rotate(fx, fy, fz, ia)); + } else { + // TODO(gw): Implement matrix decomposition and interpolation + result.push(TransformOperation::Rotate(fx, fy, fz, fa)); + } } (&TransformOperation::Perspective(fd), &TransformOperation::Perspective(_td)) => {