Skip to content
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

Rotate animation #11873

Merged
merged 3 commits into from Jul 11, 2016
Merged

Rotate animation #11873

merged 3 commits into from Jul 11, 2016

Conversation

@notriddle
Copy link
Contributor

notriddle commented Jun 26, 2016

Add rotation interpolation code for the case where their direction vectors are equal.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #11808 (github issue number if applicable).
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Jun 26, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/animation.rs
let ia = fa.interpolate(&ta, time).unwrap();
result.push(TransformOperation::Rotate(fx, fy, fz, ia));
} else {
// TODO(gw): Implement matrix decomposition and interpolation

This comment has been minimized.

@dzbarsky

dzbarsky Jun 26, 2016

Member

We should try to interpolate component-by-component when we can, see https://drafts.csswg.org/css-transforms-1/#interpolation-of-transform-functions

Specifically, "For interpolations with the primitive rotate3d(), the direction vectors of the transform functions get normalized first. If the normalized vectors are equal, the rotation angle gets interpolated numerically. Otherwise the transform functions get converted into 4x4 matrices first and interpolated as defined in section Interpolation of Matrices afterwards."

let norm_f = ((fx * fx) + (fy * fy) + (fz * fz)).sqrt();
let norm_t = ((tx * tx) + (ty * ty) + (tz * tz)).sqrt();
let (fx, fy, fz) = (fx / norm_f, fy / norm_f, fz / norm_f);
let (tx, ty, tz) = (tx / norm_t, ty / norm_t, tz / norm_t);
if fx == tx && fy == ty && fz == tz {
let ia = fa.interpolate(&ta, time).unwrap();
result.push(TransformOperation::Rotate(fx, fy, fz, ia));

This comment has been minimized.

@dzbarsky

dzbarsky Jun 28, 2016

Member

I wonder if the spec says anything about what the interpolated values for the direction vector should be...script can see this, right? Worth checking what other browsers do and adding a test if you're feeling particularly pedantic

This comment has been minimized.

@notriddle

notriddle Jun 28, 2016

Author Contributor

It says that, if the direction vectors normalize to be the same thing, just interpolate the angle. It doesn't say what to do with the direction vector in the meantime.

If they're different, it says to do the matrix conversion.

@bors-servo
Copy link
Contributor

bors-servo commented Jun 28, 2016

The latest upstream changes (presumably #11766) made this pull request unmergeable. Please resolve the merge conflicts.

@mbrubeck
Copy link
Contributor

mbrubeck commented Jul 8, 2016

r? @glennw

@highfive highfive assigned glennw and unassigned mbrubeck Jul 8, 2016
@glennw
Copy link
Member

glennw commented Jul 10, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jul 10, 2016

📌 Commit 0dd99e6 has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jul 10, 2016

Testing commit 0dd99e6 with merge beaef00...

bors-servo added a commit that referenced this pull request Jul 10, 2016
Rotate animation

Add rotation interpolation code for the case where their direction vectors are equal.
___

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11808 (github issue number if applicable).
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11873)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 11, 2016

@bors-servo bors-servo merged commit 0dd99e6 into servo:master Jul 11, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@notriddle notriddle deleted the notriddle:rotate_anim branch Jul 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.