W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2017

[csswg-drafts] Reduce matrix decomposition when rotation axis has zero coord

From: Simon Fraser via GitHub <sysbot+gh@w3.org>
Date: Thu, 12 Jan 2017 17:12:04 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-200426126-1484241123-sysbot+gh@w3.org>
smfr has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== Reduce matrix decomposition when rotation axis has zero coord ==
http://www.w3.org/mid/CAGTfzwTS9r+z1LRu=3t25NW0A6yk0b+agaH6__8ZkcSD3-LR9A@mail.gmail.com

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
transition
transform: rotate3d(1, 0, 0, 0deg);
to
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
consistent.

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
interpolate

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

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

rotate: 45deg 0 0 1
to
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
to
rotate: 810deg 0 0 1

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

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
interpolation.

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.

Cheers,
    -Shane

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/897 using your GitHub 
account
Received on Thursday, 12 January 2017 17:12:10 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:07 UTC