Skip to content

[css-transforms-2] Interpolation of rotate3D should convert to quaternions instead of a matrix. #9278

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
mattwoodrow opened this issue Aug 30, 2023 · 2 comments

Comments

@mattwoodrow
Copy link
Contributor

The current spec requires that rotate3D should be converted to a matrix (if the rotations are not along the same vector), and then interpolated (by decomposing into quaternions).

Most implementations are just converting rotate3D into quaternions directly and interpolating, and we should probably specify that.

mattwoodrow added a commit to mattwoodrow/WebKit that referenced this issue Aug 31, 2023
https://bugs.webkit.org/show_bug.cgi?id=260932
<rdar://114732141>

Reviewed by NOBODY (OOPS!).

Looks like the other engines are doing this (despite it not being what the spec says), and it's needed to pass tests.

Filed w3c/csswg-drafts#9278 to get the spec to reflect reality here.

* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-interpolation-expected.txt:
* Source/WebCore/platform/graphics/transforms/Quaternion.cpp:
(WebCore::Quaternion::fromRotate3d):
* Source/WebCore/platform/graphics/transforms/Quaternion.h:
* Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::blend):
@tabatkins
Copy link
Member

Is there an observable difference in the two behaviors?

@BorisChiou
Copy link
Contributor

BorisChiou commented Aug 31, 2023

I am also working on the Gecko bug for this: https://bugzilla.mozilla.org/show_bug.cgi?id=1737209. Gecko also converts the axis, angle into the quaternion vector directly and then apply slerp. We use this way because we would like to avoid the redundant operations, e.g. convert rotate3d() into 3d matrix, and decompose it. Converting the axis, angle pair into quaternion vector looks simpler.

However, quaternion vector works well only when the rotation angle is in (-360deg, 360deg). Gecko has this bug and I'm fixing it.

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