How Does dur="indefinite" Work in SMIL?
In Synchronized Multimedia Integration Language (SMIL), assigning
dur="indefinite" specifies that an element's simple
duration has no predefined mathematical boundary and will persist until
explicitly terminated. While a standard clock value defines a
deterministic runtime, an indefinite duration shifts lifecycle
management to external triggers, explicit end conditions, or parent
container boundaries. This mechanism allows animations, audio, video,
and structured content blocks to remain active until user interaction,
scripted DOM calls, or document hierarchy constraints resolve their
active duration.
The Role of Simple Duration
Within the SMIL timing model, the dur attribute defines
the simple duration of an element—the unrepeated, baseline span of time
required for the element to run through its presentation cycle. When
dur="indefinite" is applied, the simple duration is
evaluated as infinite.
Unlike bounded intervals (such as dur="5s"), an
indefinite simple duration never completes a natural cycle on its
own:
- Interpolation Behavior: In vector animation
contexts such as SVG using SMIL syntax (
<animate>,<set>), an indefinite simple duration prevents keyframe-based interpolations from resolving to completion unless explicit fractional timing or discrete values are evaluated. A<set>element, which changes an attribute immediately, maintains that state indefinitely. - Repetition Disablement: Attributes like
repeatCountorrepeatDurhave no observable impact when the simple duration is indefinite, as the element never reaches the end of its first cycle to trigger subsequent iterations.
Resolving Active Duration with End Conditions
An element with an indefinite simple duration does not necessarily play forever. SMIL distinguishes between simple duration (the intrinsic length of the media/animation) and active duration (the actual span of time the element is active in the document timeline).
Active duration is determined by combining begin,
dur, end, and container bounds. To terminate
an element defined with dur="indefinite", SMIL relies on
explicit end conditions specified via the end
attribute:
- Event-Driven Endings: An element can be bound to
user interface events (such as
end="click"orend="mouseover"). The element runs continuously until the specified event fires, at which point SMIL calculates the current time as the active end. - Syncbase Value Timing: An element can synchronize
its end time with the milestone of another element (such as
end="otherElement.end"orend="audioTrack.end"). - DOM Method Calls: Scripting environments can
manually conclude indefinite elements by invoking SMIL DOM methods such
as
endElement()orendElementAt().
If an element has dur="indefinite" and no
end attribute, event trigger, or container constraint, its
active duration remains infinite.
Behavior Within Sequential and Parallel Containers
The lifecycle of an indefinite element depends heavily on the time container enclosing it:
Parallel Containers
(<par>)
In a <par> container, child elements execute
concurrently. If a child element has dur="indefinite", the
default container ending rule (endsync="last") causes the
<par> container itself to remain active indefinitely
unless the indefinite child is explicitly ended or the container defines
an explicit dur or end. If the container uses
endsync="first", the indefinite element terminates as soon
as the shortest bounded sibling completes.
Sequential Containers
(<seq>)
In a <seq> container, elements execute one after
another in document order. A child element with
dur="indefinite" blocks all subsequent siblings from
starting because the current element never reaches a natural end point.
Subsequent siblings only activate if the indefinite element is ended via
an explicit trigger or event.
Post-Active State and
the fill Attribute
When an element with dur="indefinite" is finally
terminated by an external event or parent boundary, SMIL evaluates the
fill attribute to dictate rendering behavior:
fill="remove"(default): The visual or audio state applied by the element is immediately undone, removing its effects from the presentation graph once the active duration ends.fill="freeze": The visual state achieved at the exact moment of termination is preserved across the target properties for the remainder of the containing timeline.