- From: Antoine Quint <ml@graougraou.com>
- Date: Mon, 17 Jan 2005 12:48:05 +0100
- To: Bjoern Hoehrmann <derhoermi@gmx.net>
- Cc: www-svg@w3.org
- Message-Id: <A6F3300C-687D-11D9-9A8C-000393D124C4@graougraou.com>
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 "TraitAnimValueChanged" 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:xbl> <xbl:definition element="ui:button"> <traitDef name="width" namespace="" valueType="http://www.w3.org/2001/XMLSchema#float" /> <xbl:template> ... </xbl:template> <xbl:handlerGroup> <svg:handler ev:event="TraitMutationEvent"...> var attr = evt.traitLocalName; if (attr == 'width') { var animatedValue = evt.target.getFloatTrait(attr); this.fixWidth(animatedValue); } </svg:handler> </xbl:handlerGroup> </xbl:definition> </xbl:xbl> ... <ui:button width="50" ...> <svg:animate attributeName="width" by="100" begin="click" fill="freeze" /> </ui:button> ... 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 -- Antoine Quint <aq@fuchsia-design.com> W3C Invited Expert (SVG and CDF) SVG Consulting and Outsourcing http://svg.org/user/uid:2/diary
Attachments
- application/pkcs7-signature attachment: smime.p7s
Received on Monday, 17 January 2005 11:48:09 UTC