Platform/Layout/Web Animations: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Initial version)
 
(Start filling in spec issues)
Line 18: Line 18:
* Enums not shown
* Enums not shown
* Extensions to Document, Element not shown
* Extensions to Document, Element not shown
== Spec issues ==
=== Issue 1: Timing interface ===
=== Issue 2: Timing list syntax ===
=== Issue 3: play() and playNow() ===
CSS doesn't really define when animations start. That can be problematic but it can also be helpful: e.g. allows delaying animation to compensate for vsync etc.
Proposal:
interface Timeline {
  Player playNow(optional TimedItem? source = null);
  Future play(optional TimedItem? source = null);
  ...
}
<code>playNow</code> creates a new <code>Player</code> with a <code>startTime</code> set to the current time of the <a>Timeline</a>.
<code>play</code> creates a new <code>Player</code> whose <code>startTime</code> is initially <code>null</code>. The UA starts it at the earliest possible time ensuring that it begins from the first frame. When it is started, the <code>startTime</code> is filled in and the Future is resolved (passing in the <code>Player</code> as the argument).
=== Issue 4: Out of range keyframe offsets ===
=== Issue 5: The KeyframeShortcut type ===
== Implementation ==
Large pieces:
* Script API
* Rework CSS in terms of same base objects
* Rework SVG in terms of same base objects

Revision as of 06:52, 17 May 2013

Overview

Feature comparison between CSS, SVG, and Web Animations

CSS-SVG-Web-Animations.png

We could also add "Synchronizing with media" to Web Animations but I (Brian) have some uncertainty about if that will make it into v1.

Simplified class diagram of API

Web animations simplified class diagram.png

Some things have been simplified:

  • Event classes etc. not shown
  • Data types not shown
  • Keyframe related dictionaries not show
  • Timing dictionary not shown
  • Enums not shown
  • Extensions to Document, Element not shown

Spec issues

Issue 1: Timing interface

Issue 2: Timing list syntax

Issue 3: play() and playNow()

CSS doesn't really define when animations start. That can be problematic but it can also be helpful: e.g. allows delaying animation to compensate for vsync etc.

Proposal:

interface Timeline {
  Player playNow(optional TimedItem? source = null);
  Future play(optional TimedItem? source = null);
  ...
}

playNow creates a new Player with a startTime set to the current time of the <a>Timeline</a>.

play creates a new Player whose startTime is initially null. The UA starts it at the earliest possible time ensuring that it begins from the first frame. When it is started, the startTime is filled in and the Future is resolved (passing in the Player as the argument).

Issue 4: Out of range keyframe offsets

Issue 5: The KeyframeShortcut type

Implementation

Large pieces:

  • Script API
  • Rework CSS in terms of same base objects
  • Rework SVG in terms of same base objects