-
Notifications
You must be signed in to change notification settings - Fork 69
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
Interpolate transform function lists, not just matrices. #44
Comments
I’ve reproduced this here: https://bl.ocks.org/mbostock/98edae5ce16c3400b5bcd180653a3717 The way transform interpolation currently works is that it decomposes the start and end transform into a standard matrix representation, and then uses the CSS Transforms Module Level 1 specification for interpolating 2D matrices. However, what we should be doing is following the specification for interpolating transforms, not matrices; the latter only applies in the general case when the start and end transform have different structure. This will require looking at the transform as a series of transform functions, rather than immediately decomposing it. |
Great care has to be taken when implementing this feature, as the transformation lists might look different at start and end, but they can still be interpolated by the default value that is implied. For example, interpolating between The user could also specify a transformation matrix on either of side of the transition, in which case it probably makes sense to reinterpret everything as matrices. |
Consider this animation which interpolates using
interpolateTransformSvg
:Codepen
It should rotate the polygon about a constant center. Instead, the rotation center moves during the transition. If you look at the logged consolidated transform matrices, this is not that suprising:
The method of blindly taking the matrix supplied by SVGTransformList.consolidate() as a basis for interpolation is clearly not appropriate in this case.
Rotating without supplying a rotation center works is as expected.
The text was updated successfully, but these errors were encountered: