[csswg-drafts] Allow adjacent sets of filling animations to be coalesced

birtles has just created a new issue for https://github.com/w3c/csswg-drafts:

== Allow adjacent sets of filling animations to be coalesced ==
Closely related:
* Additive transform animations easily invoke undesirable matrix interpolation (#2204)
* Define requirements for retaining animations to be returned by `getAnimations()` (#2054)

Using the Web Animations API authors can easily generate animations in an unbounded fashion. Unless a means is provided to UAs to discard or compact these animations, this will result in a memory leak.

For example:

```js
elem.addEventListener('mousemove', evt => {
  circle.animate(
    { transform: `translate(${evt.clientX}, ${evt.clientY})` },
    { duration: 500, fill: 'forwards' }
  );
});
```

Comparing to other animation techniques:
* CSS transitions do not suffer this problem since there can only be one animation per property at any time.
* SMIL does not suffer this problem since each `<animate>`-type element only has one active interval at a time so that number of simultaneous animations is bounded by the number of `<animate>`-type elements (and if an author is producing `<animate>` elements in an unbounded fashion they hopefully won't be surprised to learn that they're leaking memory!).
* CSS animations technically suffers this problem except that it is more obvious to authors that they are producing a memory leak since they must explicitly append to the list of animations each time. By contrast, there is nothing in the above code to suggest to an author that they are creating a memory leak.

One reason past animations must be retained is due to the way the `getAnimations()` API is currently defined. Issue #2054 will define a means to avoid having `getAnimations()` return all such animations.

The other reason past animations must be retained is to produce the correct result when additive animations or animations with implicit keyframes are involved. As a result, even once `getAnimations()` is fixed, there are many circumstances where UAs cannot discard or compact past animations, thereby producing a memory leak.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3210 using your GitHub account

Received on Monday, 15 October 2018 05:31:57 UTC