- From: Cameron McCormack <cam@mcc.id.au>
- Date: Sat, 13 Jan 2007 11:48:37 +1100
- To: public-appformats@w3.org
Hi. This is a last call comment from the SVG WG on the XBL 2 Editor’s Draft (dated 12 January 2007). As it stands, XBL 2.0 does not afford any special treatment for SMIL animation element in SVG. We wish to have animation element targetting (in case xlink:href is omitted) behave differently than would otherwise fall out of the model. There are three use cases we want to support for animation implicit targets. The first is using an animation element at the top of a shadow tree to target the parent of the bound element: <xbl:binding element="ex|wobble"> <xbl:template> <animateMotion d="M0,0 L10,0 z" begin="0s" dur="0.5s" repeatDur="indefinite"/> </xbl:template> </xbl:binding> <text x="50" y="50"> Some wobbling text <ex:wobble/> </text> This use case is described in the last public SVG 1.2 Full draft’s Binding chapter in section 3.6 [1]. This defines an ex:wobble element that can be used in the same way as other animation elements. One way to achieve this is to define animation elements as targetting the flattened tree parent, unless that parent is the bound element that owns the shadow tree the animation element resides in, in which case it targets flattened tree parent of the bound element. Such a definition is reasonably simple. The second use case is where you want to target the actual bound element, for example if that bound element is a custom element with some traitDefs on it to respond to the animation. For example: <xbl:binding element="ex|spiral"> <xbl:template> <path …/> <animate attributeName="turns" values="5;10;5" begin="0s" dur="5s" repeatCount="indefinite"/> </xbl:template> <traitDef name="turns" namespace="" valueType="http://www.w3.org/2000/svg#SVGNumber"/> </xbl:binding> <ex:spiral/> This needs a simpler definition: animation elements always target their flattened tree parent. It would also be the behaviour under XBL without needing a special definition, AIUI. The third use case is where an animation element is a proper child of a bound element, and the animation should target that bound element. <xbl:definition element="ex|diamond"> <xbl:template> <path …/> </xbl:template> </xbl:definition> <ex:diamond> <animate …/> </ex:diamond> It makes sense for this animation to target the ex:diamond element. However, the standard XBL semantics would be for this element not to have any effect since it is not selected for inclusion into the shadow tree with an xbl:content element. To get that sort of behaviour, you could use something like the following: <xbl:definition element="ex|diamond"> <xbl:template> <path …/> <xbl:content includes="animate,animateTransform,animateMotion,…"/> </xbl:template> </xbl:definition> However, using xbl:content to include the animation elements also wouldn’t work for the “custom animation” elements, such as the ex:wobble element from the first use case, since the author of the ex:diamond binding cannot know what elements are going to be these “custom animations”. A solution is to allow animation elements at the top of a shadow tree of a bound element that is not selected into the fully flattened tree to target instead the DOM core parent of that bound element. Similarly, regular SVG animation elements such as “animate” that are not in the fully flattened tree but whose DOM core parents are can target that DOM core parent instead. Disadvantages of this approach include the fact that it breaks the view that the flattened tree is the only thing that determines the rendering behaviour in the document, and also that it would be impossible to write a binding that excludes some of the child animation elements (by not including them with an xbl:content). Thus, to handle these three use cases, we suggest that the following text (or other text that supports the same functionality) be inserted into section 4.9.6: Animation: If a SMIL animation element is in the final flattened tree and has an xlink:href attribute, then the animation target is determined by resolving the xlink:href URI against the base URI of the animation element itself. However, if the element’s xlink:href attribute is not present, the target of the animation is determined as follows: ▪ Determine the target behaviour value for the animation element by: ▪ if a correct xbl:animation-target attribute exists on the animation element, taking that attribute’s value, ▪ or if the animation element was selected into the fully flattened tree by an xbl:content element and a correct animation-target attribute exists on that xbl:content element, taking that attribute’s value, ▪ or if the animation element is in the shadow tree of a bound element, and a correct animation-target attribute exists on the xbl:template element of that binding, taking that attribute’s value, ▪ or taking the default value "parent" otherwise. ▪ If the target behaviour value is "bound-element-parent": ▪ If the animation element is in the fully flattened tree: ▪ If the animation element’s fully flattened tree parent is the bound element whose shadow tree the animation element resides in: ▪ If that bound element is in the fully flattened tree, then the target of the animation is the fully flattened tree parent of that bound element. ▪ Else, if that bound element is not in the fully flattened tree but its DOM core parent is in the fully flattened tree, then the target of the animation is the DOM core parent of that bound element. ▪ Otherwise, there is no target and the animation element is not processed. ▪ Otherwise, the animation element’s fully flattened tree parent is not the bound element, so the target of the animation is the DOM core parent of the animation element. ▪ Otherwise, there is no target and the animation element is not processed. ▪ Othwerise, the target behaviour value is "parent": ▪ If the animation element is in the fully flattened tree, then the target of the animation is the fully flattened tree parent of the animation element. ▪ Else, if the animation element is not in the fully flattened tree but its DOM core parent is in the fully flattened tree, then the target of the animation is the DOM core parent of the animation element. ▪ Otherwise, there is no target and the animation element is not processed. (The above algorithm is quite verbose, I’m sure it’s possible to simplify a bit!) In effect, you can put an xbl:animation-target attribute on the animation element itself to control how it targets, or an animation-target attribute on the xbl:content element to control how all of the animation elements selected by it will target, or an animation-target attribute on the xbl:template element to control how all animation elements in the shadow tree will target. Here are some examples that demonstrate the different targetting behaviour: <xbl:binding element="ex|widget"> <xbl:template> <path …/> <!-- The default for animation-target is "parent", so each widget has an a1 animation target that targets that widget element --> <animate id="a1" …/> </xbl:template> </xbl:binding> <xbl:binding element="ex|bounce"> <xbl:template animation-target="bound-element-parent"> <animate id="a2" …/> </xbl:template> </xbl:binding> <ex:widget> <!-- This animate element is not in the final flattened tree, but still targets the widget element –> <animate id="a3" …/> </ex:widget> <ex:widget> <!-- The bounce element is not in the final flattened tree, but the a2 animation inside its shadow tree still targets the widget element –> <ex:bounce/> </ex:widget> Corresponding descriptive text in section 2 would be needed to define the animation-target attribute(s). Renaming animation-target to xbl:animation-target would be OK for consistency. An alternative solution to use cases 1 and 2 (targetting parent or bound element parent) is to introduce an 'animations' element that is a child of the binding element, which holds animations that will target the bound element’s parent. For example: <xbl:binding element="ex|wobbleAndFlash"> <animations> <ex:wobble/> <set …/> </animations> </xbl:binding> <circle …> <ex:wobbleAndFlash/> </circle> The way the animations element would work is to, like the template element, clone its contents when the binding is applied, but its contents would be inserted into the fully flattened tree as (following) siblings of the bound element. A disadvantage with this approach is that it would be difficult to restrict the 'animations' element to have only animation element children. Thus it’s more of a 'followingSiblingTemplate' element. The three use cases discussed in this mail are important for SVG, and were to be supported before work moved to XBL 2.0. The SVG WG requests that these features (or features that allow these use cases) be introduced. Thanks, Cameron -for the SVG WG [1] http://www.w3.org/TR/2004/WD-SVG12-20041027/binding.html#sXBL-bindings-for-visual-effects -- Cameron McCormack, http://mcc.id.au/ xmpp:heycam@jabber.org ▪ ICQ 26955922 ▪ MSN cam@mcc.id.au
Received on Saturday, 13 January 2007 00:48:49 UTC