W3C home > Mailing lists > Public > public-fx@w3.org > July to September 2015

[css-transforms-1] [css-transforms-2] Quaternion rotation when one angle is 0

From: Shane Stephens <shans@google.com>
Date: Fri, 21 Aug 2015 22:22:11 +0000
Message-ID: <CAGTfzwTS9r+z1LRu=3t25NW0A6yk0b+agaH6__8ZkcSD3-LR9A@mail.gmail.com>
To: "public-fx@w3.org" <public-fx@w3.org>
Hi list,

When interpolating between rotations with different axis alignment, we
always fall back on matrix decomposition.

However, if one of the angles is 0, then the resulting behavior is that the
rotation axis snaps immediately to the other axis. So for example, if I
transform: rotate3d(1, 0, 0, 0deg);
transform: rotate3d(0, 0, 1, 810deg);

Then by the specification I should see a single 90deg rotation about the z
axis. If I cancel and restart the transition, then the intermediate results
(matrix) should force decomposition again and everything should be fairly

Two things:
(1) Firefox implements this behavior, but Chrome and Safari don't (try e.g.
http://jsfiddle.net/2vLyydzv/3/). Chrome executes a 810deg rotation but
messes up if you cancel/uncancel. Safari does something truly bizarre.

(2) this is not compatible with the rotate property from css-transforms-2,
as the rotate property can't have an intermediate result of a matrix and
will instead take a rotation. That's fine for forward transforms but if I

rotate: 0deg 1 0 0
rotate: 810deg 0 0 1

then I'll have 45deg 0 0 1 at 50%. If I cancel, then

rotate: 45deg 0 0 1
rotate: 0deg 1 0 0

will be 22.5deg 0 0 1 at 50%. If I restart the transition, then

rotate: 22.5deg 0 0 1
rotate: 810deg 0 0 1

will do angle interpolation rather than matrix rotation, and start spinning

Given the lack of conforming behavior in css-transforms-1, and (I believe)
a desire for standardized behavior between css-transforms-1 and
css-transforms-2, I'd like to propose that we special-case rotation to/from
0deg to always snap to the axis of the non-zero rotation and do numeric

This would reduce the cases in which we need to do matrix decomposition,
not produce wildly variant behavior, better match author intention, and
also make the rotate property capable of matching transform in behavior.

Received on Friday, 21 August 2015 22:22:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:54 UTC