-
Notifications
You must be signed in to change notification settings - Fork 559
Added requestAnimationFrame support #422
Conversation
sections/webappapis.include
Outdated
|
|
||
| <h3 id="animation-frames">Animation Frames</h3> | ||
|
|
||
| <p>Each <code>Document</code> associated with a <a>top-level browsing context</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use Bikeshed's markdown minimal syntax for new content:
- No need for
<p>, just separate paragraphs by a newline - Lists use numbers (
1., 2., etc.) with proper intentation as seen above (line 982 for example).
Additionally,
- Let's drop the 'algorithm' attribute below. Seems like a nice idea, but has no bearing on our spec processing
<code>Document</code>and<code>Window</code>should be{{Document}}and{{Window}}respectively, so that they link-up.
|
LGTM |
|
Reference: #159 and #375 (both slightly different, for good reason) Glad to hear requestAnimationFrame() is being restored to HTML 5.1 (unless an alternate replacement, such as #375, occurs). This is because requestAnimationFrame() has ended up becoming the defacto way of synchronize animations to refresh rate (for non-WebGL animations) and there are no alternative APIs that can do the same thing. Some suggestions: -- Strengthen requestAnimationFrame() requirement to make it mandatory to synchronize to refresh rate (end of section 5) for more consistent behavior across systems. Right now it's only a recommendation, it should be REQUIRED instead. Most web browsers do, with the surprising sole exception of Microsoft Edge (hardcoded to 60, even with non-60Hz displays) which is worse than Internet Explorer -- See http://www.testufo.com/browser.html -- Alternative: Add a flag to indicate whether rAF() synchronizes to VSYNC (syncs to refresh rate) -- such as doesRAFsyncToRefreshRate() = true|false -- #159 and #375 has many useful comments worth reading; in order to understand the importance of requestAnimationFrame() as the smoothest possible way of animations in HTML5 thanks to its ability to synchronize to VSYNC. A very good test for requestAnimationFrame() precision across several browsers: A very good comparision between web browser accuracy of requestAnimationFrame() Right now, this screen does user-agent detection out of necessity (since there's no "doesRAFsyncToRefreshRate() API) Alternatively, another idea is making it mandatory -- that browsers MUST sync rAF() to refresh rate, by making it a requirement rather than a recommendation. Knowing whether VSYNC is supported -- is very important for precision animations (e.g. www.testufo.com/eyetracking ...) which works on roughly 80-90% of browsers (including iPhones and iPads). This optical illusion animation massively malfunctions in Microsoft Edge on a 75Hz display (or any non-60Hz-multiple display) because it doesnn't synchronize animations to refresh rate. Many HTML5 games works best with precision stutter-free animations (example: perfectly smooth zero-stutter animation similar to www.testufo.com/photo ...) which is only possible when requestAnimationFrame() synchronizes successfully to the refresh rate, e.g. games that uses lots of large-area smooth-scrolling or panning effects. Fluidity of games varies a lot between browsers and platforms. Knowing whether the game synchronizes to refresh rate, can be quite useful. |
|
Update....I had the opportunity to look at the requestAnimationFrame() (aka "rAF") updates to HTML 5.1 ... some good, some bad: Two things. One good, one bad: The Logic -- LGTM 7.8 requestAnimationFrame API: 7.1.4.2 Processing Model: For the purposes of what I'm writing -- terminologies & semantics -- "Synchronizing to VSYNC" is usually synonymous to "Synchronizing to the refresh rate of the current monitor the browser window is on" -- and the old W3C rAF() standard described synchronization needs much better. While the logic LGTM, the processing model is not as good from an animation fluidity perspective, and from a standardization perspective given the magic numbers included in that paragraph. With PAL TV 50Hz, movies updated at 24Hz and sometimes 48Hz (HFR movies), VR at 90Hz, gaming at 120Hz or 144Hz, GSYNC, FreeSync, the future 8K 120Hz standard now being developed (this might be the everyday television of 2040s+), GoPro custom frame rates, many newer cheap desktop LCDs able to do 75Hz -- the sole mention of 60Hz to the exclusion of all others -- needs to be addressed. As evidenced by EDGE's internal synchronization to 60Hz regardless of the actual monitor refresh rate, your new HTML 5.1 specification is actually pandering to the EDGE browser (and its animation flaws). By mentioning "60Hz" instead of "display refresh rate", this sets a dangerous precedent for the minority rather than the majority (see www.testufo.com/browser.html for a list of browsers that properly synchronizes animations to refresh rate). Let me illustrate the differences in synchronization under the old/new standard. The old requestAnimationFrame() standard www.w3.org/TR/html51/ says:
The new HTML5.1 standard says this:
From what I see, major problems:
Bottom line, the processing model is worse in HTML 5.1 than in W3C Animation Timing Standard. I feel that magic numbers such as "60 Hz" do not belong in a specification, except as a secondary example (after having already mentioned the primary atomically-important phrase, "display refresh rate"). If this belongs in a separate document, then at least modify "60 Hz" into "display refresh rate", and reword accordingly. I am an author of two peer-reviewed papers and specification, so I have "specification writing experience" in other spheres: Although the topic matter is unrelated, and I am excessively wordy in these Comments Sections, I know the importance to be careful of wording when writing specifications. I offer to help rewrite a part of Section 7.1.4.2 of the HTML 5.1 specification, hopefully to a similar size (same number of words) while attempting to make it also superior to the paragraph at the end of section 5 of the W3C Animation Timing section. (I know it sometimes takes an hour even to properly do a paragraph!) No blame -- It is not necessarily anyone's fault -- I realize web standard developers do not have the understanding of certain motion subtleties that, for example, a video game developer or a low-level graphics device driver, needs to have (or programmer of a low-level app screen update routine -- including, say, the programmers of a web browswer). Plainly put, the current wording pertaining to requestAnimationFrame update timing. I hope my credentials are sufficient enough, to demonstrate, that a very careful, delicate rewording of section 7.1.4.2 is, indeed, definitely needed, to take care to avoid a situation like what has occured with the EDGE browser becoming worse than Internet Explorer in certain eye-pleasing animation fluidity. I love that the EDGE browser has gone into good compliance of the HTML standard, however, the assumed/magicnumber update rate of 60 Hz absolutely needs to be deleted except as a secondary example under the refresh rate heading. |
|
@mdrejhon Can you please open a new issue for this stuff, so we can close #375 and #159 and the bits that are already done? (Or I will do it, but probably not for a week or two) On a separate note, it sounds like clamping to 60Hz rather than an implementation-determined rate is not really interoperable, in which case we could mark it at risk in the HTML 5.1 Candidate Recommendation - which means it may be removed (otherwise we are stuck with it until we produce HTML 5.2 - and while the first draft of that should be around in days, the 5.1 Recommendation will probably be the latest for a year or so). |
|
chaals, I've created #785 |
* Added requestAnimationFrame support * Abort if document.hidden is true * Markdown and bikeshed linking
No description provided.