Web Animations/Requirements/Repetition

JUST AN EXAMPLE. This is one way we might start to sketch out the specifics of the requirements.


interface Animation {
  attribute float iterationCount;
  • Blurb goes here about how iterationCount functions (basically pull in and edit relevant bits from CSS Animations and SMIL)
  • Talk about range of values, i.e. iterationCount >= 0.0 or "infinite"
    • Not sure how to represent that best in WebIDL yet. Can we use define a sentinel value that equals -1.0
  • Talk about initial value, i.e. 1.0
  • What happens if we set it in correctly? Throw an exception? Stay at previous value? Go to initial value?
  • What happens when it is changed? Is it readonly? e.g.
    • If it is set to such a value that the interval should have ended what happens, what events get dispatched, and what timestamp gets associated with those events
    • If it is set to an invalid value while the animation is in play do we still send events and if so, what timestamp gets set in such a case



iteration-count = float | "infinite"

Set by the iteration-count attribute on animation elements. The attribute sets the iterationCount for new Animation objects generated by this element. Existing Animation objects are not modified.

Also set by repeatCount attribute which is now deprecated. If both are set the iteration-count attribute is used and the repeatCount attribute is ignored.

The value "indefinite" is handled as with "infinite" but is now deprecated.


SVG also provides the iteration-duration attribute.

iteration-duration = clock-value | "infinite"

This sets the iterationCount as follows:

iterationCount = iteration-duration / dur

The repeatDur is identical but is now deprecated. If both are set the iteration-duration attribute is used and the repeatDur attribute is ignored.

The value "indefinite" is handled as with "infinite" but is now deprecated.

If both iteration-count and iteration-duration are specified, the active duration is defined as the minimum of the specified iteration-duration and the simple duration multiplied by iteration-count. (Just reference SMIL here?)

ISSUE: If we introduce dur="auto" or something of that sort, then converting iteration-duration into an iterationCount might become more difficult and it might make more sense to make this part of the API.


The animation-iteration-count property sets the iterationCount attribute.

Last modified on 24 February 2012, at 00:00