Skip to content

[web-animations-1] Default timeline parameter in Animation constructor is confusing  #2078

Closed
@birtles

Description

@birtles

From @graouts on November 22, 2017 13:46

I'd like to reopen this issue. While working on implementing Web Animations in WebKit, I've found the way the optional timeline parameter is defined in the Animation constructor not to be intuitive.

Specifically, I find that calling new Animation(new KeyframeEffect(…)) and new Animation(new KeyframeEffect(…), undefined) and having the first one set timeline to document.timeline and the other to undefined is not intuitive to a JS developer, where omitted values are usually handled as undefined. I understand the reason here is that the 99% case is that authors want document.timeline as their animation's timeline, at least in the first iteration of the spec where the only concrete timeline is a DocumentTimeline. But I would argue that element.animate() is the convenience layer in the Web Animations API and that we should not add convenience features to the Animation API, or at least not in a confusing as is the case right now.

My proposed solution is to either:

  1. Require an explicit value for the timeline parameter to the Animation constructor
  2. Remove the timeline parameter from the Animation constructor

I have a preference for 1 but have no objection to 2.

Copied from original issue: w3c/web-animations#208

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions