firstDaisy Diff compare report.
Click on the changed parts for a detailed description. Use the left and right arrow keys to walk through the modifications.
last 
SVG Tiny 1.2 – 20080915 20081118

16 Animation

Contents

16.1 Introduction

SVG supports the ability to change vector graphics over time. SVG content can be animated in the following ways:

16.2 Animation elements

16.2.1 Overview

SVG's animation elements were developed in collaboration with the W3C Synchronized Multimedia (SYMM) Working Group, developers of the Synchronized Multimedia Integration Language (SMIL) 2.1 Specification [SMIL21].

SVG incorporates the animation features defined in the SMIL 2.1 specification and provides some SVG-specific extensions.

For an introduction to the approach and features available in any language that supports SMIL 2.1 Animationanimation, see the Introduction and animation sandwich model sections of the SMIL 2.1 Animation overview and SMIL 2.1 animation model. Modules ([SMIL21], sections 3.2 and 3.3.3). For the list of animation features which go beyond SMIL Animation, see SVG extensions to SMIL 2.1 Animation below.

16.2.2 Relationship to SMIL 2.1 Animation

SVG is a host language in terms of SMIL 2.1 Animation and therefore introduces additional constraints and features as permitted by that specification. Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for SVG's animation elements and attributes are those in the SMIL 2.1 Animation Modules and the SMIL 2.1 Timing and Synchronization chapter ([SMIL21], sections 3 and 10). Note that the SMIL timing engine is orthogonal to the rendering tree.

SVG supports the following four animation elements which are defined in the SMIL 2.1 Animation Modules:

  'animate'  allows scalar attributes and properties to be assigned different values over time
  'set'  a convenient shorthand for 'animate', which is useful for assigning animation values to non-numeric attributes and properties, such as the 'visibility' property
  'animateMotion'        moves an element along a motion path
  'animateColor'  modifies the color value of particular attributes or properties over time

Additionally, SVG includes the following compatible extensions to SMIL 2.1:

  'animateTransform'  modifies one of SVG's transformation attributes over time, such as the 'transform' attribute
  'path' attribute  SVG allows any feature from SVG's path data syntax to be specified in a 'path' attribute to the 'animateMotion' element (SMIL 2.1 Animation only allows a subset of SVG's path data syntax within a 'path' attribute)
  'mpath' element  SVG allows an 'animateMotion' element to contain a child 'mpath' element which references an SVG 'path' element as the definition of the motion path
  'keyPoints' attribute  SVG adds a 'keyPoints' attribute to the 'animateMotion' to provide precise control of the velocity of motion path animations
  'rotate' attribute  SVG adds a 'rotate' attribute to the 'animateMotion' to control whether an object is automatically rotated so that its x-axis points in the same direction (or opposite direction) as the directional tangent vector of the motion path

For compatibility with other aspects of the language, SVG uses IRI references via an 'xlink:href' attribute to identify the elements which are to be targets of the animations.

SMIL 2.1 Animation requires that the host language define the meaning for document begin and document end, and these are defined in the Definitions section.

16.2.3 Animation elements example

Example anim01 below demonstrates each of SVG's five animation elements.

Example: 19_01.svg
<?xml version="1.0"?>
<svg width="8cm" height="3cm"  viewBox="0 0 800 300"
     xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny">
  <desc>Example anim01 - demonstrate animation elements</desc>
  <rect x="1" y="1" width="798" height="298" 
        fill="none" stroke="blue" stroke-width="2" />
  <!-- The following illustrates the use of the 'animate' element
        to animate a rectangles x, y, and width attributes so that
        the rectangle grows to ultimately fill the viewport. -->
  <rect xml:id="RectElement" x="300" y="100" width="300" height="100"
        fill="rgb(255,255,0)"  >
    <animate attributeName="x" 
             begin="0s" dur="9s" fill="freeze" from="300" to="0" />
    <animate attributeName="y" 
             begin="0s" dur="9s" fill="freeze" from="100" to="0" />
    <animate attributeName="width" 
             begin="0s" dur="9s" fill="freeze" from="300" to="800" />
    <animate attributeName="height" 
             begin="0s" dur="9s" fill="freeze" from="100" to="300" />
  </rect>
  <!-- Set up a new user coordinate system so that
        the text string's origin is at (0,0), allowing
        rotation and scale relative to the new origin -->
  <g transform="translate(100,100)" >
    <!-- The following illustrates the use of the 'set', 'animateMotion',
         'animateColor' and 'animateTransform' elements. The 'text' element 
         below starts off hidden (i.e., invisible). At 3 seconds, it:
           * becomes visible
           * continuously moves diagonally across the viewport
           * changes color from blue to dark red
           * rotates from -30 to zero degrees
           * scales by a factor of three. -->
    <text xml:id="TextElement" x="0" y="0"
          font-family="Verdana" font-size="35.27" visibility="hidden"  > 
      It's alive!
      <set attributeName="visibility" to="visible"
           begin="3s" dur="6s" fill="freeze" />
      <animateMotion path="M 0 0 L 100 100" 
           begin="3s" dur="6s" fill="freeze" />
      <animateColor attributeName="fill"
           from="rgb(0,0,255)" to="rgb(128,0,0)"
           begin="3s" dur="6s" fill="freeze" />
      <animateTransform attributeName="transform" 
           type="rotate" from="-30" to="0"
           begin="3s" dur="6s" fill="freeze" />
      <animateTransform attributeName="transform" 
           type="scale" from="1" to="3" additive="sum"
           begin="3s" dur="6s" fill="freeze" />
    </text>
  </g>
</svg>
Example 19_01 - at zero seconds At zero seconds
 
Example 19_01 - at three seconds At three seconds
Example 19_01 - at six seconds At six seconds
 
Example 19_01 - at nine seconds At nine seconds

The sections below describe the various animation attributes and elements.

16.2.4 Attributes to identify the target element for an animation

The following attributes are common to all animation elements and identify the target element for the animation. If the target element is not capable of being a target of the animation, then the animation is ignoredhas no effect.

Refer to the descriptions of the individual animation elements for any restrictions on what types of elements can be targets of particular types of animations.

Schema: animatecommon
    <define name='svg.AnimateCommon.attr'>
      <ref name='svg.XLink.attr'/>
      <ref name='svg.Conditional.attr'/>
    </define>

Attribute definitions:

xlink:href = "<IRI>"

An IRI reference to the element which is the target of this animation and which therefore will be modified over time.

The target element must be part of the current SVG document fragment. If the target element is not part of the current SVG document fragment

, then the animation is ignored. If the

or the IRI reference is otherwise an invalid IRI reference,

for example by being a reference to a non-existent element,

then the animation has no effect. This means the animation timing will still run but no animation effect will be applied to the target attribute.

If the 'xlink:href' attribute is not provided, then the target element will be the immediate parent element of the current animation element.

'xlink:href' must point to exactly one target element. If 'xlink:href' points to multiple target elements then it shall be treated as an unsupported value and processed as if the attribute had not been specified. If xlink:href="" (the empty string), it shall be treated as if the 'xlink:href' attribute was not specified.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Specifying the animation target section of the SMIL 2.1

specification. In particular, see SMIL 2.1 Animation Modules: Specifying the animation target. Animatable: no.

Animation Modules ([SMIL21], section 3.5.1).

Animatable: no.

If the 'xml:id' or 'id' attribute of an element that is the target of an animation is changed, then whether this affects the animation is undefined, and implementation dependent. Future specifications will describe in more detail the result of modifying elements that affect animation elements which are already in the document tree.

Resolution of the animation target occurs when the animation element is inserted into the document tree or at the document begin time, whichever is later. (See also the 'timelineBegin' attribute, which controls when the document begin time occurs.)

16.2.5 Attributes to identify the target attribute or property for an animation

The following attributes identify the target attribute or property for the given target element whose value changes over time.

Schema: animateattributecommon
    <define name='svg.AnimateAttributeCommon.attr'>
      <optional>
        <attribute name='attributeName' svg:animatable='false' svg:inheritable='false'>
          <ref name='QName.datatype'/>
        </attribute>
      </optional>
      <optional>
        <attribute name='attributeType' svg:animatable='false' svg:inheritable='false'>
          <choice>
            <value>XML</value>
            <value>CSS</value>
            <value>auto</value>
          </choice>
        </attribute>
      </optional>
    </define>

Attribute definitions:

attributeName = "<QName>"

Specifies the name of the target attribute. A qualified name, if used, indicates the XML namespace for the attribute. The prefix will be resolved to a namespace name in the scope of the current (i.e. the referencing) animation element. Note that while the 'attributeName' attribute is optional, there is no lacuna value. When no value is specified the animation still runs, and events related to the animation element (e.g. beginEvent) are still fired, but the animation doesn't apply to any attribute.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Specifying the animation target section of the SMIL 2.1

specification. In particular, see SMIL 2.1 Animation Modules: Specifying the animation target

Animation Modules ([SMIL21], section 3.5.1).

Animatable: no.

attributeType = "CSS" | "XML" | "auto"

Specifies the namespace in which the target attribute and its associated values are defined. The attribute value is one of the following (values are case-sensitive):

"
CSS
"

This specifies that the value of 'attributeName' is the name of a property defined as animatable in this specification.

"
XML
"

This specifies that the value of 'attributeName' is the name of an XML attribute

defined in the default XML namespace for the

on the target element. If the value for 'attributeName' has a prefix,

the implementation must use the associated namespace name as defined in the scope of the target element

it is resolved as described above. If not, then the target attribute is in no namespace. The attribute must be defined as animatable in this specification.

"
auto
"

The

implementation

user agent should match the 'attributeName' to an animatable property or attribute

for

applicable to the target element.

The implementation

If the user agent supports CSS, it must first search through its list of supported CSS properties

for a matching property name (all properties supported by the implementation, not just those

(including those not defined by SVG)

, and if none is found, search the default XML namespace for the element.The lacuna value is auto

for a matching property name that is defined to be animatable for the target element. If no suitable property is found, the user agent must then search for a suitable animatable attibute, using the appropriate namespace. If the 'attributeName' value has no prefix, then the attribute searched for is in no namespace. If it does have a prefix, then that prefix is resolved as described above and the attribute searched for in the associated namespace. If no suitable property or attribute is found, the animation has no effect.

Note that not all properties are applicable to all SVG elements, even if an attribute of the same name is applicable to the element. In particular, the CSS 'width' and 'height' properties are not applicable to those SVG elements which have 'width' and 'height' attributes.

The lacuna value is 'auto'.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Specifying the animation target section of the SMIL 2.1

specification. In particular, see SMIL 2.1 Animation Modules: Specifying the animation target

Animation Modules ([SMIL21], section 3.5.1).

In the absence of style sheets (external style sheets,

style element, style attribute

'style' elements or 'style' attributes, as may be available in other profiles of SVG) animation of presentation attributes is equivalent to animating the corresponding property. Thus, for properties listed in SVG Tiny 1.2, the same effect occurs from animating the presentation attribute with attributeType="XML" as occurs with animating the corresponding property with attributeType="CSS".

Animatable: no.

16.2.6 Animation with namespaces

Example animns01 below shows a namespace prefix being resolved to a namespace name in the scope of the referencing element, and that namespace name being used (regardless of the prefix which happens to be used in the target scope) to identify the attribute being animated.

Example: animns01.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.2" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink">
    <title>Demonstration of the resolution of namespaces for animation</title>
    <!-- at the point of definition, the QName a:href resolves to the namespace 
        name "http://www.w3.org/1999/xlink" and the local name "href" -->
    <g xmlns:a="http://www.w3.org/1999/xlink">
        <animate attributeName="a:href" xlink:href="#foo" dur="2s" to="two.png" fill="freeze"/>
    </g>
    <!-- at the point of use, the namespace name "http://www.w3.org/1999/xlink" 
      happens to be bound to the namespace prefix 'b'  while the prefix
      'xlink' is bound to a different namespace name-->
    <g xmlns:b="http://www.w3.org/1999/xlink" xmlns:xlink="http://example.net/bar">
        <image xml:id="foo" b:href="one.png" x="35" y="50" width="410" height="160"/>
    </g>
</svg>

16.2.7 Paced animation and complex types

Paced animations assume a notion of distance between the various animation values defined by the 'to', 'from', 'by' and 'values' attributes. The following table explains how the distance between values of different types should be computed.

Distance is defined for types which can be expressed as a list of values, where each value is a vector of scalars in an n-dimensional space. For example, an angle value is a list of one value in a 1-dimensional space and a color is a list of 1 value in a 3-dimensional space.

Animation is based on the computed value of properties. Thus, keywords such as inherit which yield a computed value may be animated because the computed value is a scalar or list of scalars. For example, fill="inherit" may be animated if the computed value of fill is a color.

The following table uses the following notation to describe two values for which a distance should be computed: Va = {va0, va1, ..., van} Vb = {vb0, vb1, ..., vbn} Value TypeDescriptionDistanceExamples <coordinate> <integer> <length> <number> single 1-dimensional value. va0[0] = scalarA vb0[0] = scalarB||VaVb|| = abs(scalarA- scalarB) 'x' attribute on 'rect' stroke-width on <circle> <color> single 3-dimensional value. va0[0] = colorA vb0[0] = colorB||VaVb|| = sqrt((colorA.getRed() - colorB.getRed())^2 + (colorA.getGreen() - colorB.getGreen())^2 + (colorA.getBlue() - colorB.getBlue())^2) 'fill' attribute on 'ellipse' <list-of-lengths> <list-of-coordinates> <list-of-numbers> n 1-dimensional values. ||VaVb|| = sum(for i = 1 to n, abs(vai[0] - vbi[0])) / n 'stroke-dasharray' on 'path' <list-of-points> n 2-dimensional values There is no defined formula to pace a list of points. The request to pace should be ignored and the value of linear used instead.'points' attribute on 'polygon' <path-data> n 2-dimensional values where each value is a point in the path definition. ||VaVb|| = sum(for i = 1 to n, dist(vai,vbi)) / n dist(vai,vbi) = sqrt((vai[0] - vbi[0])^2 + (vai[1] - vbi[1])^2))'d' on 'path' <transform-list> type: translate one 2-dimensional value va0[0] = txa va0[1] = tya vb0[0] = txb vb0[1] = tyb type: rotate one 1-dimensional value and 1 2-dimensional value va0[0] = angleA va1[0] = cxa va1[1] = cya vb0[0] = angleB vb1[0] = cxb vb1[1] = cyb type: scale two 1-dimensional values va0[0] = scaleXa va1[0] = scaleYa vb0[0] = scaleXb vb1[0] = scaleYb type: skewX, skewY single 1-dimension value va0[0] = skewXorYa vb0[0] = skewXorYbtype: translate ||VaVb|| = dist(v_a0 ,v_b0 ) = sqrt((v_a0 [0] - v_b0 [0])^2 + (v_a0 [1] - v_b0 [1])^2)) type: rotate ||VaVb|| = (abs(angleA - angleB)) type: scale ||VaVb|| = sqrt((scaleXa - scaleXb)^2 + (scaleYa - scaleYb)^2) type: skewX, skewY ||VaVb|| = abs(skewXorYa- skewXorYb)'transform' attribute on 'g' using 'animateTransform'

Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'. In the list of distance functions below, Va and Vb represent the two values the distance between which is being calculated.

Since paced animation is intended to produce an animation with an even pace of change, it does not make sense to define distance functions for all data types. Distance can be usefully defined for types whose values are n-dimensional vectors (including scalars, which are 1-dimensional vectors). For example, a <length> value is a scalar value, and a <color> value is a 3-dimensional vector. Thus attributes of these types can have paced animation applied to them. On the other hand, a <list-of-length> (as used by 'stroke-dasharray') is a list of scalars (1-dimensional vectors), and <points-data> (as used by the 'points' attribute on a 'polygon') is a list of 2-dimensional vectors. Therefore, these types do not have a distance function defined and cannot have paced animation applied to them.

The distance functions for types that support paced animation are as follows:

<coordinate>, <integer>, <length> and <number>

distance(Va, Vb) = |Va − Vb|

Examples: animating the 'x' attribute on a 'rect', or the 'stroke-width' property on a 'circle'.

<color>

distance(Va, Vb) = sqrt((Va.red − Vb.red)2 + (Va.green − Vb.green)2 + (Va.blue − Vb.blue)2), where:

Vi.red is the red component of the Vi color value,
Vi.green is the green component of the Vi color value, and
Vi.blue is the blue component of the Vi color value.

Each of the color component values is usually in the range [0, 1], where 0 represents none of that color component, and 1 represents the maximum amount of that color component, in the sRGB gamut [SRGB]. Since <color> values may specify colors outside of the sRGB gamut, these component values may lie outside the range [0, 1].

Example: animating the 'fill' property on an 'ellipse'.

Transform definitions of type 'translate'

distance(Va, Vb) = sqrt((Va.tx − Vb.tx)2 + (Va.ty − Vb.ty)2), where:

Vi.tx is the x component of the Vi translation transform value, and
Vi.ty is the y component of the Vi translation transform value.

Example (for all transform definition types): animating the 'transform' attribute on a 'g' using 'animateTransform'.

Transform definitions of type 'scale'

distance(Va, Vb) = sqrt((Va.sx − Vb.sx)2 + (Va.sy − Vb.sy)2), where:

Vi.sx is the x component of the Vi scale transform value, and
Vi.sy is the y component of the Vi scale transform value.

Note that, as when specifying scale transformations in a <transform-list>, if the y component of the scale is omitted it is implicitly equal to the x component.

Transform definitions of type 'rotate', 'skewX' and 'skewY'

distance(Va, Vb) = sqrt((Va.angle − Vb.angle)2), where:

Vi.angle is the angle component of the Vi rotation or skew transform value.

Since the distance function for rotations is not in terms of the rotation center point components, a paced animation that changes the rotation center point may not appear to have a paced movement when the animation is applied.

Distance functions for all other data types are not defined. If calcMode="paced" is used on an animation of an attribute or property whose type is not one of those listed above, the animation effect is undefined. SVG user agents may choose to perform the animation as if calcMode="linear", but this is not required. Authors are recommended not to specify paced animation on types not listed above.

16.2.8 Attributes to control the timing of the animation

The following attributes are common to all animation elements and control the timing of the animation, including what causes the animation to start and end, whether the animation runs repeatedly, and whether to retain the end state the animation once the animation ends.

The These timing attributes also applies apply to Media Elements media elements.

Schema: animatetiming
    <define name='svg.AnimateTiming.attr' combine='interleave'>
      <ref name='svg.AnimateTimingNoMinMax.attr'/>
      <optional><attribute name='min' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='max' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
    </define>

    <define name='svg.AnimateTimingNoMinMax.attr' combine='interleave'>
      <ref name='svg.AnimateTimingNoFillNoMinMax.attr'/>
      <optional>
        <attribute name='fill' svg:animatable='false' svg:inheritable='false'>
          <choice>
            <value>remove</value>
            <value>freeze</value>
          </choice>
        </attribute>
      </optional>
    </define>

    <define name='svg.AnimateTimingNoFillNoMinMax.attr' combine='interleave'>
      <ref name='svg.AnimateBegin.attr'/>
      <optional><attribute name='dur' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='end' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='repeatCount' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='repeatDur' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional>
        <attribute name='restart' svg:animatable='false' svg:inheritable='false'>
          <choice>
            <value>always</value>
            <value>never</value>
            <value>whenNotActive</value>
          </choice>
        </attribute>
      </optional>
    </define>

    <define name='svg.AnimateBegin.attr' combine='interleave'>
      <optional><attribute name='begin' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
    </define>

In the syntax specifications that follow, optional white space is indicated as "S", defined as follows:

S ::= (#x20 | #x9 | #xD | #xA)*

Attribute definitions:

begin = "begin-value-list"

Defines when the element should begin (i.e. become active). The attribute value is a semicolon separated list of timing specifier values.

The definition of begin-value-list is as follows:

begin-value-list ::= begin-value ( S? ";" S? begin-value-list )?

A semicolon separated list of begin values. The interpretation of a list of begin times is detailed in SMIL 2.1 section on "Evaluation of begin and end time lists".

begin-value ::= ( offset-value | syncbase-value | event-value | repeat-value | accessKey-value | "indefinite" )

Describes the element begin time.

offset-value ::= ( S? "+" | "-" S? )? ( <Clock-value> )

For SMIL 2.1, this describes the element begin as an offset from an implicit syncbase. For SVG, the implicit syncbase begin is defined to be relative to the document begin. Negative begin times are entirely valid and easy to compute, as long as there is a resolved document begin time.

syncbase-value ::= ( Id-value "." ( "begin" | "end" ) ) ( S? ( "+" | "-" ) S? <Clock-value> )?

Describes a syncbase and an optional offset from that syncbase. The element begin is defined relative to the begin or active end of another animation. A syncbase consists of an ID reference to another animation element followed by either .begin or .end to identify whether to synchronize with the beginning or active end of the referenced animation element.

event-value ::= ( Id-value "." )? ( event-ref ) ( S? ( "+" | "-" ) S? <Clock-value> )?

Describes an event and an optional offset that determine the element begin. The animation begin is defined relative to the time that the event is

raised

dispatched to the event-base element. The list of event

-symbols

names available for

a given event-base element is listed in the '

use as the event-ref value can be found in the "Animation event name

'

" column

in

of the Complete list of supported events table. Details of event-based timing are described in the Unifying event based and scheduled timing section of SMIL 2.1

: Unifying Event-based and Scheduled Timing.

Timing and Synchronization ([SMIL21], section 10.11).

repeat-value ::= ( Id-value "." )? "repeat("
integer
<integer> ")" ( S? ( "+" | "-" ) S? <Clock-value> )?

Describes a qualified repeat event and an optional offset that will begin the element. The element begin is defined relative to the time that the

repeat

repeatEvent event is

raised

dispatched to the event-base element with the

specified

iteration value specified by the integer, which must be positive.

accessKey-value ::= "accessKey(" character ")" ( S? ( "+" | "-" ) S? <Clock-value> )?

Describes

an accessKey that determines

a key press event and an optional offset that will begin the element

begin

. The element begin is defined relative to the time of the keydown event corresponding to the specified key. From a formal processing model perspective, an accessKey

is

-value corresponds to a keydown event listener on the document which behaves as if stopPropagation() and preventDefault() have both been invoked in the capture phase. (See Event flow for consequences of this behavior.)

The

"

character

"

value can be one of two types. It can be any of the keyboard event identifier strings listed in the key identifiers set. Alternatively, this value can be a single Unicode character [UNICODE]. In this case, the

"

single character

" value

is mapped to a keyboard identifier for the purpose of processing the accessKey-value event listener. For example, 'accessKey(Q)' will translate into a keydown event listener using "U+0051" as the target keyboard identifier string, as if 'accessKey(U+0051)' were used.

"indefinite"

The begin of the animation will be determined by a beginElement() method call or a hyperlink targeted to the element. (Hyperlink-based timing is described in SMIL 2.1 Timing and Synchronization: Hyperlinks and timing.)

In SVG, if no 'begin' is specified, the default timing of the time container is equivalent to an offset value of '0'. If the 'begin' attribute is syntactically invalid, in the list itself or in any of the individual list values, it is equivalent to a single 'begin' value of 'indefinite'.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the basic timing support section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'begin' attribute and

Timing and Synchronization. See also the special parsing rules for Id-value and event-ref as described in

SMIL 2.1:

the Parsing timing specifiers ([SMIL21], section 10.4.1).

Animatable: no.

dur = "<Clock-value>" | "media" | "indefinite"

Specifies the simple duration. The attribute value can

be either

one of the following:

<Clock-value>

Specifies the length of the simple duration in document time. Value must be greater than 0.

media

Specifies the simple duration as the intrinsic media duration. This is only valid for elements that define media.

(

For SVG's animation elements, if 'media' is specified, the attribute will be ignored.

)
indefinite

Specifies the simple duration as indefinite.

If the animation does not have a 'dur' attribute, the simple duration is indefinite. Note that interpolation will not work if the simple duration is indefinite (although this may still be useful for 'set' elements).

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Dur value semantics section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'dur' attribute

Timing and Synchronization ([SMIL21], section 10.4.1).

Animatable: no.

end = "end-value-list"

Defines an end value for the animation that can constrain the active duration. The attribute value is a semicolon separated list of values.

end-value-list ::= end-value (S? ";" S? end-value-list )?

A semicolon separated list of end values. The interpretation of a list of end times is detailed below.

end-value ::= ( offset-value | syncbase-value | event-value | repeat-value | accessKey-value | "indefinite" )
Describes the active end of the animation.

A value of 'indefinite' specifies that the end of the animation will be determined by an endElement() method call.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is

the SMIL 2.1 specification. In particular, see description

found in the basic timing support section of SMIL 2.1

: 'end' attribute and

Timing and Synchronization. See also the special parsing rules for Id-value and event-ref as described in

SMIL 2.1:

the Parsing timing specifiers ([SMIL21], section 10.4.1).

Animatable: no.

min = "<Clock-value>" | "media"

Specifies the minimum value of the active duration. The attribute value can be either of the following:

<Clock-value>

Specifies the length of the minimum value of the active duration, measured in local time.

Value

The value must be greater than 0.

media

Specifies the minimum value of the active duration as the intrinsic media duration. This is only valid for elements that define media.

(

For SVG's animation elements, if 'media' is specified, the attribute will be ignored.

)

The lacuna value for 'min' is '0'. This does not constrain the active duration at all.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the More control over the active duration section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'min' attribute

Timing and Synchronization. ([SMIL21], section 10.4.1).

Animatable: no.

max = "<Clock-value>" | "media"

Specifies the maximum value of the active duration. The attribute value can be either of the following:

<Clock-value>

Specifies the length of the maximum value of the active duration, measured in local time.

Value

The value must be greater than 0.

media

Specifies the maximum value of the active duration as the intrinsic media duration. This is only valid for elements that define media.

(

For SVG's animation elements, if 'media' is specified, the attribute will be ignored.

)

There is no lacuna value for 'max'.

This does not constrain

If omitted, the active duration is not constrained at all.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the More control over the active duration section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'max' attribute

Timing and Synchronization. ([SMIL21], section 10.4.1).

Animatable: no.

restart = "always" | "whenNotActive" | "never"
always

The animation can be restarted at any time.

 

This is the lacuna value.

whenNotActive

The animation can only be restarted when it is not active (i.e. after the active end). Attempts to restart the animation during its active duration are ignored.

never

The element cannot be restarted for the remainder of the current simple duration of the parent time container. (In the case of SVG, since the parent time container is the SVG document fragment,

then

the animation cannot be restarted for the remainder of the document duration.)

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is

the

found in The restart attribute section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'restart' attribute

Timing and Synchronization ([SMIL21], section 10.4.1).

Animatable: no.

repeatCount = "<number>" | "indefinite"

Specifies the number of iterations of the animation function. It can have the following attribute values:

<number>

This is a (base 10) "floating point" numeric value that specifies the number of iterations. It can include partial iterations expressed as fraction values. A fractional value describes a portion of the simple duration ([SMIL21], section 3.5.2). Values must be greater than 0.

indefinite

The animation is defined to repeat indefinitely (i.e. until the document ends).

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Repeating elements section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'repeatCount' attribute

Timing and Synchronization ([SMIL21], section 10.4.1).

Animatable: no.

repeatDur = "<Clock-value>" | "indefinite"

Specifies the total duration for repeat. It can have the following attribute values:

<Clock-value>

Specifies the duration in document time to repeat the animation function f(t) ([SMIL21], section 3.3.1).

"indefinite"

The animation is defined to repeat indefinitely (i.e. until the document ends).

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Repeating elements section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'repeatDur' attribute

Timing and Synchronization ([SMIL21], section 10.4.1).

Animatable: no.

fill = "freeze" | "remove"

This attribute can have the following values:

freeze

The animation effect f(t) ([SMIL21], section 3.3.1) is defined to freeze the effect value at the last value of the active duration. Note that in the case of discrete animation, the frozen value that is used is the value of the animation just before the end of the active duration. The animation effect is "frozen" for the remainder of the document duration (or until the animation is restarted

- see SMIL 2.1: Restarting animation

— see The restart attribute ([SMIL21], section 10.4.1).

remove

The animation effect is removed (no longer applied) when the active duration of the animation is over. After the active end of the animation, the animation no longer affects the target (unless the animation is restarted

- see SMIL 2.1: Restarting animation

— see The restart attribute ([SMIL21], section 10.4.1).

This is the lacuna value.

Except for any SVG-specific rules explicitly mentioned in this specification, the normative definition for this attribute is found in the Extending an element section of SMIL 2.1

specification. In particular, see SMIL 2.1: 'fill' attribute

Timing and Synchronization ([SMIL21], section 10.4.1).

Animatable: no.

The

SMIL 2.1

specification

defines the detailed processing rules associated with the above attributes.

Except for any SVG-specific rules explicitly mentioned in this specification, the SMIL 2.1 specification is the normative definition of the processing rules for the above attributes.

event-base element

This section is informative.

For a normative reference definition of event-base elementelements, see the SMIL 2.1 Animation Modules ([SMIL21], section 3) and the multimedia Multimedia section of this specification. For declarative animation or elements and the 'discard' elements element, the default event-base element is the animation target, which for elements with an 'xlink:href' attribute is the target IRI, and is otherwise the parent element. The default event-base element for all SVG Media media elements (e.g. 'audio', 'video', and 'animation') is the element itself. For all event-values that are prefaced with an Id-value, the event-base element is the element indicated by that idID.

Authoring Notenote: non-rendered elements such as the 'audio' element cannot receive user-initiated pointer events, so it is recommended that authors specify a rendered element as the event-base element for such cases when using user interface events.

Clock values

Clock values have a subsetted syntax of the clock values syntax defined in SMIL 2.1: Clock values: ([SMIL21], section 10.4.1):

Clock-val         ::= Timecount-val
Timecount-val     ::= Timecount ("." Fraction)? (Metric)?
Metric            ::= "s" | "ms"
Fraction          ::= DIGIT+
Timecount         ::= DIGIT+
DIGIT             ::= [0-9]

For Timecount timecount values, the default metric suffix is "s" (for seconds). No embedded white space is allowed in clock values, although leading and trailing white space characters will be ignored.

Clock values describe document time.

The following are examples of legal clock values:

Fractional values are just (base 10) floating point definitions of seconds. Thus:

00.5s = 500 milliseconds

16.2.9 Attributes that define animation values over time

The following attributes are common to elements 'animate', 'animateMotion', 'animateColor' and 'animateTransform'. These attributes define the values that are assigned to the target attribute or property over time. The attributes below provide control over the relative timing of keyframes and the interpolation method to be used between discrete particular values.

Schema: animatevalue
    <define name='svg.AnimateToCommon.attr' combine='interleave'>
      <optional><attribute name='to' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
    </define>

    <define name='svg.AnimateValueCommon.attr'>
      <ref name='svg.AnimateToCommon.attr'/>
      <optional>
        <attribute name='calcMode' svg:animatable='false' svg:inheritable='false'>
          <choice>
            <value>discrete</value>
            <value>linear</value>
            <value>paced</value>
            <value>spline</value>
          </choice>
        </attribute>
      </optional>
      <optional><attribute name='values' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='keyTimes' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='keySplines' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='from' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
      <optional><attribute name='by' svg:animatable='false' svg:inheritable='false'><text/></attribute></optional>
    </define>

Attribute definitions:

calcMode = "discrete" | "linear" | "paced" | "spline"

Specifies the interpolation mode for the animation. This can take any of the following values. The

default mode

lacuna value is 'linear

, however

', except on 'animateMotion' elements where it is 'paced'. However if the target attribute does not support

linear

interpolation (e.g.

for strings

when animating an attribute whose type is <string>), the 'calcMode' attribute is ignored and discrete

interpolation

animation is used.

discrete

This specifies that the animation function will jump from one value to the next without any interpolation.

linear

Simple linear interpolation between values is used to calculate the animation function.

Except for 'animateMotion', this is the default 'calcMode'.
paced

Defines interpolation to produce an even pace of change across the animation. This is only supported for

values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced

the data types for which there is an appropriate distance function defined, which includes only scalar numeric types plus the types listed in Paced animation and complex types. If 'paced' is specified, any 'keyTimes' or 'keySplines' will be ignored.