@@ -34,7 +34,7 @@ Previous Version: [https://github.com/webplatformco/project-image-animation/blob
3434 3 . [ Other Alternatives] ( #other-alternatives )
3535</details >
3636
37- ## User Needs & Use Cases
37+ ## User Needs & Use Cases {#user-needs--use-cases}
3838Animated images (as enabled by GIF, APNG, WebP) are in common use on the web,
3939for a variety of reasons, such as:
4040* Purely decorative design elements
@@ -97,9 +97,9 @@ But this is not always practical:
9797 being able to work directly with the markup's ` <img> ` tags
9898 is far easier than trying to replace them on the fly with something else.
9999
100- ## User Research
100+ ## User Research {#user-research}
101101
102- ### Developer & User Signals
102+ ### Developer & User Signals {#developer--user-signals}
103103A few examples amongst many of people asking for that type of functionality.
104104* Stack overflow:
105105 [ 1] ( https://stackoverflow.com/questions/20644209/play-gif-on-mouseover-and-pause-gif-on-mouse-out-without-replacing-images )
@@ -113,24 +113,24 @@ A few examples amongst many of people asking for that type of functionality.
113113 [ 1] ( https://old.reddit.com/r/HTML/comments/3hjccx/how_can_i_animate_and_stop_gifs_with_mouse_hover/ )
114114 [ 2] ( https://old.reddit.com/r/FirefoxCSS/comments/1523xwr/stop_animated_gifs_play_on_hoverclick/ )
115115
116- ### Current Workarounds
116+ ### Current Workarounds {#current-workarounds}
117117Numerous workarounds exist (further highlighting author/user demand),
118118all with a variety of downsides.
119119See the [ “Current Workarounds” section of the Images-in-video explainer] ( ../images-in-video#user-content-current-workarounds ) for a brief discussion.
120120
121- ## Goals
121+ ## Goals {#goals}
122122* Provide declarative syntax to enable/disable animation of images
123123* Handle images that are part of the content as well as decorative images
124124* Enable applying different settings to different images
125125* Enable simple user interactions (e.g. click to play)
126126* Work with existing markup and/or without
127127
128- ### Non-goals
128+ ### Non-goals {#non-goals}
129129* Turning animated images into fully fledged video player.
130130 (This [ could be pursued separately] ( ../images-in-video/README.md ) ,
131131 but is not the focus of this explainer.)
132132
133- ## Proposed Solution
133+ ## Proposed Solution {#proposed-solution}
134134
135135The proposed solution is a css property to control animation of images.
136136At its most basic version, it would take the following form:
@@ -176,7 +176,7 @@ all values have the same effect (i.e. none).
176176 the image animation plays,
177177 without synchronization with any other instance of the same image on the page.
178178
179- ### Sample Code Snippets
179+ ### Sample Code Snippets {#sample-code-snippets}
180180Turn off all image animations on the page:
181181``` css
182182:root { image-animation : paused ; }
@@ -222,7 +222,7 @@ Interesting effects can easily be achieved in combination with other CSS:
222222.carousel img :snapped { image-animation : play; }
223223```
224224
225- ### Beyond the Basics
225+ ### Beyond the Basics {#beyond-the-basics}
226226
227227A key limitation of the above property is encountered
228228when authors want to set up a means for users
@@ -236,7 +236,7 @@ to activate the animation.
236236Two approaches are being considered to complement the basic design above.
237237
238238
239- #### High-level Approach
239+ #### High-level Approach {#high-level-solution}
240240
241241An additional value can be added to the ` image-animation ` property:
242242* ** controlled** :
@@ -270,7 +270,7 @@ Same as above, in response to a [user request for reduced motion](https://drafts
270270```
271271
272272
273- #### Low-level Approach
273+ #### Low-level Approach {#low-level-solution}
274274
275275The ` :animated-image ` pseudo-class can be introduced,
276276and represents content image elements
@@ -286,9 +286,9 @@ without having to modify the DOM to add additional markup,
286286an ` ::overlay ` pseudo-element could be added to ` <img> `
287287enabling generated content or other effects to be easily placed over the image.
288288
289- ### Possible Extensions
289+ ### Possible Extensions {#possible-extensions}
290290
291- #### Control Over Iterations
291+ #### Control Over Iterations {#control-over-iterations}
292292Animated image formats such as GIF, WebP, or APNG include information
293293about how many times the animation is supposed to run.
294294This could be made into an overridable default, with alternate possibilities being specified in CSS.
@@ -325,7 +325,7 @@ when the element is focused or hovered.
325325}
326326```
327327
328- #### Longhands And Further Controls
328+ #### Longhands And Further Controls {#longhands-and-further-controls}
329329The property above could be broken down into longhands
330330possibly similar to those of the ` animation-* ` family of properties
331331(` image-animation-play-state ` , ` image-animation-iteration-count ` ).
@@ -341,12 +341,12 @@ For instance,
341341` loop ` in ` animation-iteration-count ` is actually called ` infinite ` ,
342342and ` once ` would be ` 1 ` .
343343
344- #### Control Over the Paused State
344+ #### Control Over the Paused State {#control-over-the-paused-state}
345345The ` paused ` value could be extended to give control over which frame of the image is displayed when it is stopped.
346346
347347` paused [ first | last | last-shown | <time> | <percent> | <number> ] ? `
348348
349- ### Accessibility Considerations
349+ ### Accessibility Considerations {#accessibility-considerations}
350350* Web pages can already contain animated images,
351351 and appropriate ` alt ` text is already expected to be provided.
352352 ”Cartoon coyote being squashed by a falling anvil“
@@ -368,7 +368,7 @@ The `paused` value could be extended to give control over which frame of the ima
368368 ` overflow: auto ` / ` scroll ` makes elements focusable,
369369 only when there is something to scroll.
370370
371- ### Privacy Considerations
371+ ### Privacy Considerations {#privacy-considerations}
372372With regards to decorative images,
373373this property enables control over image animation cross origin,
374374without leaking any information about whether the image is actually animatable or not.
@@ -409,9 +409,9 @@ We argue that this is an acceptable trade-off:
409409 If implemented, it means the situation would not just be analogous,
410410 but that whether an image is animatable would already be knowable cross-origin anyway.
411411
412- ## Complementary Solutions
412+ ## Complementary Solutions {#complementary-solutions}
413413
414- ### Images in the ` <video> ` Element
414+ ### Images in the ` <video> ` Element {#images-in-the-video-element}
415415See [ the explainer for “Images in ` <video> ` ”] ( ../images-in-video/README.md ) .
416416
417417Animated images are effectively videos without a sound track.
@@ -427,14 +427,14 @@ Pursuing both would make sense.
427427
428428*** …insert summary table showing overlap and differences…***
429429
430- ### What About ` <img control> ` ?
430+ ### What About ` <img control> ` ? {#what-about-img-control}
431431
432432*** …insert discussion of why that's not a full substitute,
433433but of how both features can be made compatible with each other if that's desired…***
434434
435- ## Rejected Alternatives
435+ ## Rejected Alternatives {#rejected-alternatives}
436436
437- ### Provide this as a UA Setting
437+ ### Provide this as a UA Setting {#provide-this-as-a-ua-setting}
438438Firefox's ` about:config ` has ` image.animation_mode ` ,
439439which can turn off all image animations,
440440and Safari respects macOS's “auto-play animated images” setting (default on, can be turn off).
@@ -476,7 +476,7 @@ More interestingly, the setting could be reinterpreted in terms of the CSS prope
476476}
477477```
478478
479- ### Reuse the Existing ` animation-* ` Properties
479+ ### Reuse the Existing ` animation-* ` Properties {#reuse-the-existing-animation--properties}
480480Properties like ` animation-play-state: running | paused `
481481or ` animation-iteration-count: infinite | <number [0,∞]> `
482482have value space that are similar to what is proposed here.
@@ -505,7 +505,7 @@ If the regular `animation-*` properties cannot be made to apply by default and w
505505it makes little sense to try and shoehorn image animations into them,
506506even if there are similarities.
507507
508- ### Other Alternatives
508+ ### Other Alternatives {#other-alternatives}
509509
510510*** This section is a work in progress.***
511511
0 commit comments