Re: [css-transforms] transform interpolation rules should operate better on their own results


On Feb 27, 2014, at 12:48 AM, L. David Baron <dbaron@dbaron.org> wrote:

> I'm sending this feedback as a result of a Mozilla bug report, filed
> by an author who saw bad transform interpolation behavior:
> https://bugzilla.mozilla.org/show_bug.cgi?id=977311

> 
> http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms says:
> 
>  If from- and to-transform have the same number of transform
>  functions, each transform function pair has either the same name,
>  or is a derivative of the same primitive.
> 
> Then http://dev.w3.org/csswg/css-transforms/#interpolation-of-transform-functions :
> 
>  The transform functions matrix(), matrix3d() and perspective() get
>  converted into 4x4 matrices first and interpolated as defined in
>  section Interpolation of Matrices afterwards.
> 
> This means that if you interpolate two lists that consist of:
>  perspective() rotateY()
>  perspective() rotateY()
> you get an interpolation result that is:
>  matrix3D() rotateY()
> 
> When you try to interpolate that result with another value of the form:
>  perspective() rotateY()
> we fall back to the "Lists don't match" path in the first quote.
> 
> 
> This is important for reversing of partially-completed transitions.
> If an author has
>  div {
>    transition: transform;
>    transform: perspective(800px) rotateY(180deg);
>  }
>  #container:hover div {
>    transform: perspective(800px) rotateY(300deg);
>  }
> then if the transition is interrupted partway through, it should
> reverse the same way it came (per-function interpolation) rather
> than reversing in an entirely different way (matrix interpolation
> fallback).

You have the start and end value and know when you interrupted the animation. So you could reverse animation function and therefore the animation using the same algorithms as you started the animation.

Is it correct to assume that the interpolation values that you get by matrix interpolation can not be reversed correctly? If that is the case, do you have other suggestions?

We could do a numerical interpolation for perspective() as well. I need to investigate why chose not to do this.

Greetings,
Dirk


> 
> -David
> 
> -- 
> 𝄞   L. David Baron                         http://dbaron.org/   𝄂
> 𝄢   Mozilla                          https://www.mozilla.org/   𝄂
>             Before I built a wall I'd ask to know
>             What I was walling in or walling out,
>             And to whom I was like to give offense.
>               - Robert Frost, Mending Wall (1914)

Received on Thursday, 27 February 2014 15:50:07 UTC