W3C home > Mailing lists > Public > public-svg-wg@w3.org > January to March 2012

Linear interpolation of discrete values

From: Brian Birtles <bbirtles@mozilla.com>
Date: Fri, 13 Jan 2012 17:11:41 +1100
Message-ID: <4F0FCB1D.5060201@mozilla.com>
To: public-svg-wg@w3.org
Hi all,

In our discussion about allowing linear interpolation on discrete values
(e.g. enumerations) I raised the concern that I thought SMIL somewhere
suggested using discrete animation even when linear interpolation is
possible if the animation values used enumerated values.[1]

It turned out the prose in question actually refers to addition:

  If a given attribute or property can take values of keywords (which
are not additive) or numeric values (which are additive), then additive
animations are possible if the subsequent animation uses a numeric value
even if the base animation uses a keyword value; however, if the
subsequent animation uses a keyword value, additive animation is not
possible.[2]

As a result it doesn't impact the proposal.

Gecko and Presto don't appear to heed the above section with regards to
addition either. I couldn't get sensible results out of WebKit for the
following test (it possibly doesn't support single-valued values animation).

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
 <script>
   function reportColours() {
    var colours = "";
    colours += "a:" + getColourForId("a");
    colours += "\n";
    colours += "b:" + getColourForId("b");
    alert(colours);
   }
   function getColourForId(id) {
    var elem = document.getElementById(id);
    return window.getComputedStyle(elem).getPropertyValue("color");
   }
 </script>
 <g color="rgb(50,50,50)" id="a">
   <animate attributeName="color" values="rgb(105,105,105)" additive="sum"/>
 </g>
 <g color="rgb(50,50,50)" id="b">
   <animate attributeName="color" values="dimgrey" additive="sum"
   onbegin="reportColours()"/>
 </g>
</svg>

Both Gecko and Presto report

  a:rgb(155, 155, 155)
  b:rgb(155, 155, 155)

Best regards,

Brian Birtles

(ACTION-3210)

[1] http://www.w3.org/2012/01/12-svg-irc#T00-50-31
[2] http://www.w3.org/TR/SVG11/animate.html#AnimationAttributesAndProperties
Received on Friday, 13 January 2012 06:12:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:14 UTC