|
1 | 1 |
|
2 | | -Quick Start |
3 | | ------------ |
4 | | - |
5 | | -To provide native Chrome Web Animation features (`Element.animate` and Playback |
6 | | -Control) in other browsers, use `web-animations.min.js`. To explore all of the |
7 | | -proposed Web Animations API, use `web-animations-next.min.js`. |
8 | | - |
9 | 2 | What is Web Animations? |
10 | 3 | ----------------------- |
11 | 4 |
|
12 | | -Web Animations is a new JavaScript API for driving animated content on the web. |
13 | | -By unifying the animation features of SVG and CSS, Web Animations unlocks |
14 | | -features previously only usable declaratively, and exposes powerful, |
15 | | -high-performance animation capabilities to developers. |
| 5 | +A new JavaScript API for driving animated content on the web. By unifying |
| 6 | +the animation features of SVG and CSS, Web Animations unlocks features |
| 7 | +previously only usable declaratively, and exposes powerful, high-performance |
| 8 | +animation capabilities to developers. |
16 | 9 |
|
17 | | -For more details see the |
18 | | -[W3C specification](http://w3c.github.io/web-animations/). |
| 10 | +What is in this repository? |
| 11 | +--------------------------- |
19 | 12 |
|
20 | | -What is the polyfill? |
21 | | ---------------------- |
| 13 | +A JavaScript implementation of the Web Animations API that provides Web |
| 14 | +Animation features in browsers that do not support it natively. The polyfill |
| 15 | +falls back to the native implementation when one is available. |
22 | 16 |
|
23 | | -The polyfill is a JavaScript implementation of the Web Animations API. It is |
24 | | -supported on modern versions of all major browsers, including: |
25 | | - |
26 | | -* Chrome |
27 | | -* Firefox 27+ |
28 | | -* IE10+ (including Edge) |
29 | | -* Safari (iOS) 7.1+ |
30 | | -* Safari (Mac) 9+ |
31 | | - |
32 | | -Getting Started |
33 | | ---------------- |
| 17 | +Quick start |
| 18 | +----------- |
34 | 19 |
|
35 | | -Here's a simple example of an animation that scales and changes the opacity of |
36 | | -a `<div>` over 0.5 seconds. The animation alternates producing a pulsing |
37 | | -effect. |
| 20 | +Here's a simple example of an animation that fades and scales a `<div>`. |
| 21 | +[Try it as a live demo.](http://jsbin.com/yageyezabo/edit?html,js,output) |
38 | 22 |
|
39 | 23 | ```html |
| 24 | +<!-- Include the polyfill --> |
40 | 25 | <script src="web-animations.min.js"></script> |
41 | | -<div class="pulse" style="width:150px;">Hello world!</div> |
| 26 | + |
| 27 | +<!-- Set up a target to animate --> |
| 28 | +<div class="pulse" style="width: 150px;">Hello world!</div> |
| 29 | + |
| 30 | +<!-- Animate! --> |
42 | 31 | <script> |
43 | 32 | var elem = document.querySelector('.pulse'); |
44 | | - var animation = elem.animate([ |
45 | | - {opacity: 0.5, transform: "scale(0.5)"}, |
46 | | - {opacity: 1.0, transform: "scale(1)"} |
47 | | - ], { |
| 33 | + var animation = elem.animate({ |
| 34 | + opacity: [0.5, 1], |
| 35 | + transform: ['scale(0.5)', 'scale(1)'], |
| 36 | + }, { |
48 | 37 | direction: 'alternate', |
49 | 38 | duration: 500, |
50 | | - iterations: Infinity |
| 39 | + iterations: Infinity, |
51 | 40 | }); |
52 | 41 | </script> |
53 | 42 | ``` |
54 | 43 |
|
55 | | -Web Animations supports off-main-thread animations, and also allows procedural |
56 | | -generation of animations and fine-grained control of animation playback. See |
57 | | -<http://web-animations.github.io> for ideas and inspiration - or [web-animations-codelabs](https://github.com/web-animations/web-animations-codelabs). |
| 44 | +Documentation |
| 45 | +------------- |
58 | 46 |
|
59 | | -Native Fallback |
60 | | ---------------- |
61 | | - |
62 | | -When the polyfill runs on a browser that implements `Element.animate` and |
63 | | -`Animation` Playback Control it will detect and use the underlying native |
64 | | -features. |
| 47 | +* [Codelab tutorial](https://github.com/web-animations/web-animations-codelabs) |
| 48 | +* [Examples of usage](/docs/examples.md) |
| 49 | +* [Live demos](https://web-animations.github.io/web-animations-demos) |
| 50 | +* [MDN reference](https://developer.mozilla.org/en-US/docs/Web/API/Element/animate) |
| 51 | +* [W3C specification](http://w3c.github.io/web-animations/) |
65 | 52 |
|
66 | | -Different Build Targets |
67 | | ------------------------ |
| 53 | +We love feedback! |
| 54 | +----------------- |
68 | 55 |
|
69 | | -### web-animations.min.js |
70 | | - |
71 | | -Tracks the Web Animations features that are supported natively in browsers. |
72 | | -Today that means Element.animate and Playback Control in Chrome. If you’re not |
73 | | -sure what features you will need, start with this. |
74 | | - |
75 | | -### web-animations-next.min.js |
76 | | - |
77 | | -Contains all of web-animations.min.js plus features that are still undergoing |
78 | | -discussion or have yet to be implemented natively. |
79 | | - |
80 | | -### web-animations-next-lite.min.js |
81 | | - |
82 | | -A cut down version of web-animations-next, it removes several lesser used |
83 | | -property handlers and some of the larger and less used features such as matrix |
84 | | -interpolation/decomposition. |
85 | | - |
86 | | -### Build Target Comparison |
87 | | - |
88 | | -| | web-animations | web-animations-next | web-animations-next-lite | |
89 | | -|------------------------|:--------------:|:-------------------:|:------------------------:| |
90 | | -|Size (gzipped) | 15KB | 18KB | 15KB | |
91 | | -|Element.animate | ✔ | ✔ | ✔ | |
92 | | -|Timing input (easings, duration, fillMode, etc.) for animation effects| ✔ | ✔ | ✔ | |
93 | | -|Playback control | ✔ | ✔ | ✔ | |
94 | | -|Support for animating lengths, transforms and opacity| ✔ | ✔ | ✔ | |
95 | | -|Support for animating other CSS properties| ✔ | ✔ | 🚫 | |
96 | | -|Matrix fallback for transform animations | ✔ | ✔ | 🚫 | |
97 | | -|KeyframeEffect constructor | 🚫 | ✔ | ✔ | |
98 | | -|Simple GroupEffects & SequenceEffects | 🚫 | ✔ | ✔ | |
99 | | -|Custom Effects | 🚫 | ✔ | ✔ | |
100 | | -|Timing input (easings, duration, fillMode, etc.) for groups</div>| 🚫 | 🚫\* | 🚫 | |
101 | | -|Additive animation | 🚫\* | 🚫\* | 🚫 | |
102 | | -|Motion path | 🚫\* | 🚫\* | 🚫 | |
103 | | -|Modifiable keyframe effect timing| 🚫 | 🚫\* | 🚫\* | |
104 | | -|Modifiable group timing | 🚫 | 🚫\* | 🚫\* | |
105 | | -|Usable inline style\*\* | ✔ | ✔ | 🚫 | |
106 | | - |
107 | | -\* support is planned for these features. |
108 | | -\*\* see inline style caveat below. |
109 | | - |
110 | | -Caveats |
111 | | -------- |
112 | | - |
113 | | -Some things won’t ever be faithful to the native implementation due to browser |
114 | | -and CSS API limitations. These include: |
115 | | - |
116 | | -### Inline Style |
117 | | - |
118 | | -Inline style modification is the mechanism used by the polyfill to animate |
119 | | -properties. Both web-animations and web-animations-next incorporate a module |
120 | | -that emulates a vanilla inline style object, so that style modification from |
121 | | -JavaScript can still work in the presence of animations. However, to keep the |
122 | | -size of web-animations-next-lite as small as possible, the style emulation |
123 | | -module is not included. When using this version of the polyfill, JavaScript |
124 | | -inline style modification will be overwritten by animations. |
125 | | -Due to browser constraints inline style modification is not supported on iOS 7 |
126 | | -or Safari 6 (or earlier versions). |
127 | | - |
128 | | -### Prefix handling |
129 | | - |
130 | | -The polyfill will automatically detect the correctly prefixed name to use when |
131 | | -writing animated properties back to the platform. Where possible, the polyfill |
132 | | -will only accept unprefixed versions of experimental features. For example: |
133 | | - |
134 | | -```js |
135 | | -var effect = new KeyframeEffect(elem, {"transform": "translate(100px, 100px)"}, 2000); |
136 | | -``` |
137 | | - |
138 | | -will work in all browsers that implement a conforming version of transform, but |
139 | | - |
140 | | -```js |
141 | | -var effect = new KeyframeEffect(elem, {"-webkit-transform": "translate(100px, 100px)"}, 2000); |
142 | | -``` |
143 | | - |
144 | | -will not work anywhere. |
145 | | - |
146 | | -API and Specification Feedback |
147 | | ------------------------------- |
148 | | - |
149 | | -File an issue on GitHub: <https://github.com/w3c/web-animations/issues/new>. |
150 | | -Alternatively, send an email to <[email protected]> with subject line |
151 | | -“[web-animations] … message topic …” |
| 56 | +* For feedback on the API and the specification: |
| 57 | + * File an issue on GitHub: <https://github.com/w3c/web-animations/issues/new> |
| 58 | + * Alternatively, send an email to <[email protected]> with subject line |
| 59 | +"[web-animations] ... message topic ..." |
152 | 60 | ([archives](http://lists.w3.org/Archives/Public/public-fx/)). |
153 | 61 |
|
154 | | -Polyfill Issues |
155 | | ---------------- |
| 62 | +* For issues with the polyfill, report them on GitHub: |
| 63 | +<https://github.com/web-animations/web-animations-js/issues/new>. |
156 | 64 |
|
157 | | -Report any issues with this implementation on GitHub: |
158 | | -<https://github.com/web-animations/web-animations-next/issues/new>. |
| 65 | +Keep up-to-date |
| 66 | +--------------- |
159 | 67 |
|
160 | | -Breaking changes |
161 | | ----------------- |
| 68 | +Breaking polyfill changes will be announced on this low-volume mailing list: |
| 69 | +[[email protected]](https://groups.google.com/forum/#!forum/web-animations-changes). |
162 | 70 |
|
163 | | -When we make a potentially breaking change to the polyfill's API |
164 | | -surface (like a rename) we will, where possible, continue supporting the |
165 | | -old version, deprecated, for three months, and ensure that there are |
166 | | -console warnings to indicate that a change is pending. After three |
167 | | -months, the old version of the API surface (e.g. the old version of a |
168 | | -function name) will be removed. *If you see deprecation warnings you |
169 | | -can't avoid it by not updating*. |
| 71 | +More info |
| 72 | +--------- |
170 | 73 |
|
171 | | -We also announce anything that isn't a bug fix on |
172 | | -[[email protected]](https://groups.google.com/forum/#!forum/web-animations-changes). |
| 74 | +* [Technical details about the polyfill](/docs/support.md) |
| 75 | + * [Browser support](/docs/support.md#browser-support) |
| 76 | + * [Fallback to native](/docs/support.md#native-fallback) |
| 77 | + * [Feature list](/docs/support.md#features) |
| 78 | + * [Feature deprecation and removal processes](/docs/support.md#process-for-breaking-changes) |
| 79 | +* To test experimental API features, try one of the |
| 80 | + [experimental targets](/docs/experimental.md) |
0 commit comments