W3C home > Mailing lists > Public > www-svg@w3.org > January 2005

Re: SVG12: Locating animation targets

From: Antoine Quint <ml@graougraou.com>
Date: Mon, 17 Jan 2005 12:48:05 +0100
Message-Id: <A6F3300C-687D-11D9-9A8C-000393D124C4@graougraou.com>
Cc: www-svg@w3.org
To: Bjoern Hoehrmann <derhoermi@gmx.net>
On 17 janv. 2005, at 12:18, Bjoern Hoehrmann wrote:

>>> It further seems that implementations are not required to expose the
>>> animated value of attributes on custom elements, which means one 
>>> cannot
>>> write script code that considers new animated values which means that
>>> animating attributes on custom elements would have little effect in
>>> practise.
>> In fact, implementations are required to expose animated values of
>> attributes on custom elements via traits. There is a <traitDef/>
>> element to specify the datatype of attributes on a custom element, a
>> complete set of APIs to access the attributes, and trait mutation
>> events to be notify of changes. In my opinion all the pieces are in
>> place for providing custom animation facilities in SVG+sXBL.
> Maybe you can give me a hand and cite the sections that require this 
> and
> maybe even provide an example that helps to get a better idea of how 
> one
> should author such functionality? Your claims did not really change my
> current impression, even after reviewing the relevant sections again.

Section 3.7:

"A trait is a potentially animatable parameter associated with an 
element. A trait is the value that gets assigned through an XML 
attribute or CSS style or SMIL animation. In the case of sXBL, it 
describes an attribute on a custom element, allowing it to be exposed 
to the animation engine and allowing typed-base DOM access using method 
calls such as getFloatTrait()."

then, section 3.8:

"If a trait value or the animated value of a trait changes for any 
reason, a TraitMutationEvent is fired.
interface TraitMutationEvent : events::Event
          // event is dispatched to the element and does not bubble
          // event names are "TraitValueChanged" and 
          DOMString traitNamespace;
          DOMString traitLocalName;

A trait change is different from a regular attribute change. For 
instance a numeric trait changing its attribute value from "1" to "1.0" 
does not change the value of the trait. The value of the trait is not 
attached to the event, because traits can be of different types. The 
value must be retrieved from the element."

Thus, you could write the following content to have a custom element 
with custom attributes respond to animations:

     <xbl:definition element="ui:button">
       <traitDef name="width" namespace="" 
valueType="http://www.w3.org/2001/XMLSchema#float" />
         <svg:handler ev:event="TraitMutationEvent"...>
           var attr = evt.traitLocalName;
           if (attr == 'width') {
             var animatedValue = evt.target.getFloatTrait(attr);
   <ui:button width="50" ...>
     <svg:animate attributeName="width" by="100" begin="click" 
fill="freeze" />

There is no specific wording requiring implementations to support 
traits, but as a basis in the SVG spec, every feature described feature 
is required unless noted otherwise.

Antoine Quint <aq@fuchsia-design.com>
W3C Invited Expert (SVG and CDF)
SVG Consulting and Outsourcing

Received on Monday, 17 January 2005 11:48:09 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:01 UTC