Skip to content

[css-transforms-2] Provide more information or a link for the interpolation on rotate property #4516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BorisChiou opened this issue Nov 18, 2019 · 2 comments

Comments

@BorisChiou
Copy link
Contributor

BorisChiou commented Nov 18, 2019

It would be nice to have interop for the interpolation on rotate property if possible, but at very least "SLERP" in the spec should probably link to somewhere, e.g. interpolation on quaternion vectors. And it'd be great to provide more details about how to convert a rotate axis and angle into a quaternion.
For example:

  1. Normalize rotate vectors of from and to values.
  2. Convert rotate: x y z Tdeg into quaternion (a, b, c, d) for from and to values.
  3. Do interpolation by SLERP (provided a link)
  4. Convert the interpolated quaternion, (a', b', c', d'), into rotate: x' y' z' T'deg.

If (2) (4) are included in the decomposing/recomposing of the 4x4 matrix, perhaps we should explicitly mention it.

@dbaron
Copy link
Member

dbaron commented Oct 21, 2021

I agree that this should be clearer. It should probably also be more consistent with the rules for interpolating the rotate() transform function, which does not use matrix interpolation when the axes match.

It also needs to be clear about how to convert the result back to a computed value -- both for css-typed-om access to rotate() and for any computed/resolved value access to rotate. For example, if the result is the identity matrix, the result probably ends up as 0deg regardless of the original axes. (This also gives a good reason to avoid going into matrix interpolation in all cases.)

Also #897 is related.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 21, 2021
I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
@dbaron
Copy link
Member

dbaron commented Oct 21, 2021

The rules for interpolation of rotate3d() are basically what I'd expect to be used for both.

I'd also note that those rules need to handle vectors that can't be normalized (probably by using the other vector).

And I think the rule that none should be replaced by 0deg when interpolating might be wrong; it's possible it (like an un-normalizable vector) should be weaker at producing the resulting vector than a 0deg rotation around a normalizable vector.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 21, 2021
I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237448
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933958}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 21, 2021
I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237448
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933958}
pull bot pushed a commit to luojiguicai/chromium that referenced this issue Oct 21, 2021
I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237448
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933958}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 29, 2021
…ition.html., a=testonly

Automatic update from web-platform-tests
Fix 2 test expectations in rotate-composition.html.

I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237448
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933958}

--

wpt-commits: eba3c32a20388ad2fe560d27dc08999ace4b96f2
wpt-pr: 31350
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Nov 1, 2021
…ition.html., a=testonly

Automatic update from web-platform-tests
Fix 2 test expectations in rotate-composition.html.

I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237448
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933958}

--

wpt-commits: eba3c32a20388ad2fe560d27dc08999ace4b96f2
wpt-pr: 31350
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this issue Nov 18, 2021
I previously adjusted the expectations for this test in
https://crrev.com/19620452a45a851f38799bcc2bd5ddb9d5b120ac .  However, I
believe these two expectations were incorrect both before and after that
adjustment, and the behavior shown in both Chromium and Gecko is
correct.  (WebKit differs slightly by producing 'none' rather than
'0deg'.)

I think this is correct because we're interpolating between two transforms:
 (a) '1 2 3 360deg' (the result of an add)
 (b) '0 1 0 100deg'
Since the normalized axes differ, this interpolation falls into the
rules for interpolation of matrices, as described in
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions .
(The rules for the 'rotate' property incorrectly say that SLERP is
always used, but I think that should be fixed to match the rules for the
rotate() function.  Either way, however, this test expectation should be
based on interpolation of matrices using SLERP.)  Since the matrix for
(a) is the identity matrix, and the progress of the interpolation is at
0, the result is the identity matrix, which should (although the spec
should make this explicit) be represented as 0deg.  This should be fixed
in w3c/csswg-drafts#4516 .

Bug: 1180834
Change-Id: I0a5e15535da56949fc88bdf48423b41d409fe290
Fixed: 1006239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237448
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933958}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants