web-animations/web-animations-js — pull request #618 by joeytwiddle (2014-06-27 05:55:34+00:00)
Title: Decompose matrices individually to allow rotate(0deg) -> rotate(360deg) after a matrix

Previously in `transformType.interpolate()` the presence of a matrix forced itself and *all later transforms* to be decomposed into matrices for interpolation. But decomposing `rotate(0deg)` and `rotate(360deg)` into matrices breaks the interpolation of the angle value. (Both of those rotations decompose into the same identity matrix!)

This patch attempts to work around this: when a matrix (or incompatible types) are encountered, we only perform decomposition at that stage of the composition. Later interpolations can be performed without decomposition into matrices.

I added a test case `auto-test-composite-transforms-matrix-rotate.html` (a slight modification of `
auto-test-composite-transforms.html`).

dt.play(new Animation(divs[0], [
{transform: "matrix(1,0,0,1,0,0) rotate(0deg)"},
{transform: "matrix(1,0,0,1,200,0) rotate(360deg)"},
], timing));

With the old behaviour the first div does not rotate at all. With the new behaviour you will see it performing a rotation.

Concerns:

- It looks like `from.decompositionPair = to;` and `from.decomposition` were assigned as a way of caching the decomposed matrix, but I did not reproduce caching in this patch.