W3C home > Mailing lists > Public > www-svg@w3.org > November 2002

Re: Declarative animation limitations

From: Ken Shoemake <ksmrq@netscape.net>
Date: Fri, 29 Nov 2002 23:55:23 -0500
To: www-svg@w3.org
Message-ID: <5DE2543D.3C86891A.00014AB2@netscape.net>

Chris Lilley <chris@w3.org> wrote:

>It would be very dumb. But I am puzzled by your assertion that only
>linear interpolation is possible.
>OK so you don't want linear, paced does not help this case too much
>either, discrete makes it worse but spline seems like a good fit, no?

You would think so, eh? But no. (And thanks for your attention.)

First, I know you're busy, but if you look at my SVG code, you will see that I make heavy use of calcMode="spline". So clearly I know it exists. Because my animation does what I want, you might also conclude I know how it works.

But your comment makes it clear you jumped to the same obvious -- but wrong -- interpretation as most readers will.

Go back and study the description of "spline" mode in both SVG and SMIL. It appears under the description of *timing* controls. And *that's all it can control*! The description of calcMode says:
     Interpolates from one value in the values list to the next
     according to a time function defined by a cubic Bézier spline."
Note it is only the *time function* which is splined. And above Figure 2,
 "Another way of describing this is that the horizontal axis is the
 input unit time for the interval, and the vertical axis is the output
 unit time."
Again, it is clear that keySplines only control *timing*.

But I want to spline *data*, not timing!

For example, suppose I wish to animate a scalar value like circle radius. Using values="1; 4; 0; 2" and calcMode="linear" gives me a piecewise linear path from 1 to 4 to 0 to 2. The first derivative changes abruptly at each control value, which will be clearly visible. So will calcMode="spline" give a smooth interpolant? No, it will only change the timing.

A 1D Bezier curve with those values would smoothly change from 1 to 2, rising and falling and rising again, with beginning tangent adjusted by the 4 and ending tangent adjusted by the 0. The circle radius would never grow to 4 nor shrink to 0. Desirable as the Bezier curve is, SVG (and SMIL) do not provide for it.

Another example: The width of a rectangle is a scalar, as is the height. Directly using SVG's facilities I can only move the bottom right corner along a piecewise linear path, not along a curve. Controlling timing with calcMode="spline" does not change that fact.

What I have done in my example code is subtle and difficult. Do not mistake it for the simple use of spline mode I have just described as inadequate.

Suppose I have values="0; 1". A linear timing curve would give the function
 f(t) = t
as time t sweeps from 0 to 1. However by use of keySplines I can adjust the timing alone to give
 f(t) = t^3
which is one of the Bernstein basis functions for a cubic Bezier curve. If I use instead values="0; 5", I multiply the weight function by 5. Sadly, I can generate t^2 this way also -- thus allowing a power basis -- but I cannot get the other three cubic Bernstein basis functions like 3t(1-t)^2. Yet I eventually found a way -- rather more complicated -- to get the four needed basis functions (if the inner controls are scaled). Thus by running *four animations simultaneously* -- one for each basis function -- I am able to synthesize the Bezier data paths I want using additive="sum".

Again I emphasize that with only one animation I can get only piecewise linear data paths, not smooth curves.

As I said, and as I hope you will now agree, this aspect of SVG *is* dumb!

Does that make my complaint clear enough for you?

-- Ken

The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
Received on Friday, 29 November 2002 23:56:59 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:23 GMT