W3C home > Mailing lists > Public > www-style@w3.org > March 2009

Re: [css3-2d-transforms] matrix animation

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Fri, 27 Mar 2009 20:23:28 +0100
To: www-style@w3.org
Message-Id: <200903272023.28164.Dr.O.Hoffmann@gmx.de>
Chris Marrin:

> >
> > Well, then explain a simple approach for authors to specify an
> > animation (direct interpolation) between matrix A and matrix B
> > with an accuracy better than one device pixel.
> > If you can do it with the current draft, then I'm almost convinced,
> > that at least nothing is missing, even if other things are available
> > twice.
> I'm not sure what you mean by "better than one device pixel". 

That is a requirement for example for SVGT1.2 and SVGT1.1, one can 
simply test (and for several tests WebKit is already better with this 
as for example Opera ;o)

> If you 
> have a matrix with just translation values, for instance, then matrix
> animation would animate from one to the other just as accurately as
> animating the components directly. 

No. It is noted:

"If the ‘from’ and ‘to’ transforms are both single functions of the 
same type: 
For matrix: 
the matrix is decomposed using the method described by unmatrix into separate 
translation, scale, rotation and skew matrices, then each decomposed matrix 
is interpolated numerically, and finally combined in order to produce a 
resulting 3x2 matrix.
That is in general not the same a to interpolate between the components of
the matrix.
If I want to do exactly this, the decomposition causes a lot of trouble,
because one has to work around it with a lot of values within the animation
and one has to calculate carefully, how small the steps have to be to
meet the 'device pixel' condition.

> Same for scale and rotation. It's 
> when you combine everything that things get interesting. And in that
> case, we believe the author's intent is to go from one "pose" to
> another in the most natural way. For instance, if one pose is the
> object at a scale of 0.5 with a slight cant up and to the left and the
> other pose is the object at a scale of 1 with a slight cant up and to
> the right, then we believe the author's intent is to smoothly scale up
> the object while at the same time pivoting from left to right. And
> that's what you would get with matrix animation. For instance:
>      from: -webkit-transform: scale(0.5) rotateX(15deg) rotateY(-30deg);
>      to:     -webkit-transform: rotateX(15deg) rotateY(30deg);

I count this as 'stupid notation', if an author does it - ok and we
all know, that authors will do this, if there is an effect. 
I would try a completely arbitrary mix, where nothing in the two 
lists fits together, just to see what happens ;o)
But such funny cases are not in the center of my interest, because
it is simple for authors to provide two sets fitting together to avoid
such a problem. Whether this is tried to fix somehow or whether 
nothing happens to indicate that the author should note unambiguously, 
what was intended, is a matter of taste...

> This can't do a component by component animation because the functions
> don't match. But a decomposed matrix animation would give you the
> desired result. 

If the matrix animation is left to animate between the components,
this can be simply used to trigger the decomposition:

from: -webkit-transform: scale(1) matrix(...);
to:     -webkit-transform: matrix(...);

then results in a decomposition and this one not:

from: -webkit-transform: matrix(...);
to:     -webkit-transform: matrix(...);

> And linear interpolation of the matrix values would 
> give add a implicit converse scale that would interfere visibly with
> the smoothness of the scale from 0.5 to 1.
> Do you have any practical use cases where a linear interpolation would
> do something reasonable (much less preferable) where a decomposed
> matrix would not?

I think, I already noted IFS (iterated functions systems, done with a
cascade of nested use elements in SVG for example), they are often
used with a matrix as generator and can create something like
tree structures or leafs, fractal structures - to animate those
matrices can result in quite interesting effects (assuming that the
processor is fast enough to compute this, well we have CUDA-GPUs
today with more than a Tera-FLOP, but if the author is careful,
with a simple sample this works pretty good already with an 
ordinary 10Giga-FLOP processor).
But if you have both an IFS with recursive used use elements
and you have to work around the decomposition of a matrix
doing a lot of number crunching again to get a proper animation 
with a lot of values, this will get soon to much and the simplicity 
of notation for IFS is lost again.

> > And it does not solve the possible mathematical problem with the
> > inverse, just to believe, that it works ;o)
> > I had already similar discussions to fix such believes for
> > constrained transformations in SVGT1.2.
> A non-invertible matrix would result in nothing rendered, so what
> practical use do you have for them? Again practical examples would be
> helpful.

Ok, an author may want to start or end something as an 0D or 1D object
to fade in or out an object - nasty, if it just does not work, because there
is a problem with the decomposition, the author does not really need to
fade in or out. Obviously the author can do this with scaling too, not just
with matrix, but with matrix this can be simply generalised to get a
less simple effect to avoid, that it gets boring to the audience soon.

In an animation with more than two values an author may want to
mirror an object, setting explicitly one value to a lower dimension.

Note, that with vector-effect non-scaling-stroke  of SVGT1.2 it is
possible to keep such low dimensional objects visible, this can
result in other interesting effects with animated objects or animated

Received on Friday, 27 March 2009 19:31:21 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:25 UTC