animejs 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,6 +20,33 @@
20
20
  <img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/juliangarnier?style=flat-square&logo=github">
21
21
  </p>
22
22
 
23
+ ## Sponsors
24
+
25
+ Anime.js is 100% free and is only made possible with the help of our sponsors.
26
+ Help the project become sustainable by sponsoring us on <a target="_blank" href="https://github.com/sponsors/juliangarnier">GitHub Sponsors</a>.
27
+
28
+ ### Platinum sponsors
29
+
30
+ <p>
31
+ <a target="_blank" href="https://ice.io/?ref=animejs">
32
+ <picture>
33
+ <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/ice-open-network-logomark.png">
34
+ <img align="center" src="./assets/sponsors/ice-open-network-logomark-dark.png" width="250">
35
+ </picture>
36
+ </a>
37
+ </p>
38
+
39
+ ### Silver sponsors
40
+
41
+ <p>
42
+ <a target="_blank" href="https://www.lambdatest.com?utm_source=animeJS&utm_medium=organic&utm_campaign=july_08&utm_term=sk&utm_content=opensource">
43
+ <picture>
44
+ <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/lambdatest-logomark.png">
45
+ <img align="center" src="./assets/sponsors/lambdatest-logomark-dark.png" width="150">
46
+ </picture>
47
+ </a>
48
+ </p>
49
+
23
50
  ## Usage
24
51
 
25
52
  Anime.js V4 works by importing ES modules like so:
@@ -56,52 +83,9 @@ animate('.square', {
56
83
 
57
84
  The full documentation is available [here](https://animejs.com/documentation).
58
85
 
59
- ## Our sponsors
86
+ ## V3 Migration guide
60
87
 
61
- Anime.js is 100% free and is only made possible with the help of our sponsors.
62
- Help the project become sustainable by sponsoring us on <a target="_blank" href="https://github.com/sponsors/juliangarnier">GitHub Sponsors</a>.
63
-
64
- ## Platinum sponsors
65
-
66
- <table>
67
- <tr>
68
- <td>
69
- <a target="_blank" href="https://huly.io/?ref=animejs">
70
- <picture>
71
- <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/huly-logomark.svg">
72
- <img align="center" src="./assets/sponsors/huly-logomark-dark.svg" width="128">
73
- </picture>
74
- </a>
75
- </td>
76
- <td>
77
- <a target="_blank" href="https://ice.io/?ref=animejs">
78
- <picture>
79
- <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/ice-open-network-logomark.svg">
80
- <img align="center" src="./assets/sponsors/ice-open-network-logomark-dark.svg" width="128">
81
- </picture>
82
- </a>
83
- </td>
84
- <td>
85
- <a target="_blank" href="https://github.com/sponsors/juliangarnier">
86
- <picture>
87
- <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/placeholder.svg">
88
- <img align="center" src="./assets/sponsors/placeholder-dark.svg" width="128">
89
- </picture>
90
- </a>
91
- </td>
92
- </tr>
93
- <tr>
94
- <td align="center">
95
- <a target="_blank" href="https://huly.io/?ref=animejs">Huly</a>
96
- </td>
97
- <td align="center">
98
- <a target="_blank" href="https://ice.io/?ref=animejs">Ice Open Network</a>
99
- </td>
100
- <td align="center">
101
- <a target="_blank" href="https://github.com/sponsors/juliangarnier">Your logo here</a>
102
- </td>
103
- </tr>
104
- </table>
88
+ You can find the v3 to v4 migration guide [here](https://github.com/juliangarnier/anime/wiki/Migrating-from-v3-to-v4).
105
89
 
106
90
  ## NPM development scripts
107
91
 
@@ -117,173 +101,4 @@ Then, execute the following scripts with `npm run <script>`.
117
101
  | `test-node` | Start all Node related tests |
118
102
  | `open-examples` | Start a local server to browse the examples locally |
119
103
 
120
- ## V4 API breaking changes overview
121
-
122
- ### Animations
123
-
124
- ```diff
125
- - import anime from 'animejs';
126
- + import { animate, createSpring, utils } from 'animejs';
127
-
128
- - anime({
129
- - targets: 'div',
130
- + animate('div', {
131
- translateX: 100,
132
- rotate: {
133
- - value: 360,
134
- + to: 360,
135
- - easing: 'spring(.7, 80, 10, .5)',
136
- + ease: createSpring({ mass: .7, damping: 80, stiffness: 10, velocity: .5}),
137
- },
138
- - easing: 'easeinOutExpo',
139
- + ease: 'inOutExpo',
140
- - easing: () => t => Math.cos(t),
141
- + ease: t => Math.cos(t),
142
- - direction: 'reverse',
143
- + reversed: true,
144
- - direction: 'alternate',
145
- + alternate: true,
146
- - loop: 1,
147
- + loop: 0,
148
- - round: 100,
149
- + modifier: utils.round(2),
150
- - begin: () => {},
151
- + onBegin: () => {},
152
- - update: () => {},
153
- + onUpdate: () => {},
154
- - change: () => {},
155
- + onRender: () => {},
156
- - changeBegin: () => {},
157
- - changeComplete: () => {},
158
- - loopBegin: () => {},
159
- - loopComplete: () => {},
160
- + onLoop: () => {},
161
- - complete: () => {},
162
- + onComplete: () => {},
163
- });
164
- ```
165
-
166
- ### Promises
167
-
168
- ```diff
169
- - import anime from 'animejs';
170
- + import { animate, utils } from 'animejs';
171
-
172
- - anime({ targets: target, prop: x }).finished.then(() => {});
173
- + animate(target, { prop: x }).then(() => {});
174
- ```
175
-
176
- ### Timers
177
-
178
- ```diff
179
- - import anime from 'animejs';
180
- + import { createTimer } from 'animejs';
181
-
182
- - anime({
183
- + createTimer({
184
- - duration: Infinity,
185
- - update: () => {},
186
- + onUpdate: () => {},
187
- });
188
- ```
189
-
190
- ### Timelines
191
-
192
- ```diff
193
- - import anime from 'animejs';
194
- + import { createTimeline, stagger } from 'animejs';
195
-
196
- - anime.timeline({
197
- + createTimeline({
198
- - duration: 500,
199
- - easing: 'easeInOutQuad',
200
- + defaults: {
201
- + duration: 500,
202
- + ease: 'inOutQuad',
203
- + }
204
- - loop: 2,
205
- + loop: 1,
206
- - }).add({
207
- - targets: 'div',
208
- + }).add('div', {
209
- rotate: 90,
210
- })
211
- - .add('.target:nth-child(1)', { opacity: 0, onComplete }, 0)
212
- - .add('.target:nth-child(2)', { opacity: 0, onComplete }, 100)
213
- - .add('.target:nth-child(3)', { opacity: 0, onComplete }, 200)
214
- - .add('.target:nth-child(4)', { opacity: 0, onComplete }, 300)
215
- + .add('.target', { opacity: 0, onComplete }, stagger(100))
216
- ```
217
-
218
- ### Stagger
219
-
220
- ```diff
221
- - import anime from 'animejs';
222
- + import { animate, stagger } from 'animejs';
223
-
224
- - anime({
225
- - targets: 'div',
226
- + animate('div', {
227
- - translateX: anime.stagger(100),
228
- + translateX: stagger(100),
229
- - delay: anime.stagger(100, { direction: 'reversed' }),
230
- + translateX: stagger(100, { reversed: true }),
231
- });
232
- ```
233
-
234
- ### SVG
235
-
236
- ```diff
237
- - import anime from 'animejs';
238
- + import { animate, svg } from 'animejs';
239
-
240
- - const path = anime.path('path');
241
- + const { x, y, angle } = svg.createMotionPath('path');
242
-
243
- - anime({
244
- - targets: '#shape1',
245
- + animate('#shape1', {
246
- - points: '70 41 118.574 59.369 111.145 132.631 60.855 84.631 20.426 60.369',
247
- + points: svg.morphTo('#shape2'),
248
- - strokeDashoffset: [anime.setDashoffset, 0],
249
- + strokeDashoffset: svg.drawLine(),
250
- - translateX: path('x'),
251
- - translateY: path('y'),
252
- - rotate: path('angle'),
253
- + translateX: x,
254
- + translateY: y,
255
- + rotate: angle,
256
- });
257
- ```
258
-
259
- ### Utils
260
-
261
- ```diff
262
- - import anime from 'animejs';
263
- + import { utils } from 'animejs';
264
-
265
- - const value = anime.get('#target1', 'translateX');
266
- + const value = utils.get('#target1', 'translateX');
267
-
268
- - anime.set('#target1', { translateX: 100 });
269
- + utils.set('#target1', { translateX: 100 });
270
-
271
- - anime.remove('#target1');
272
- + utils.remove('#target1');
273
-
274
- - const rounded = anime.round(value);
275
- + const rounded = utils.round(value, 0);
276
- ```
277
-
278
- ### Engine
279
-
280
- ```diff
281
- - import anime from 'animejs';
282
- + import { engine } from 'animejs';
283
-
284
- - anime.suspendWhenDocumentHidden = false;
285
- + engine.pauseWhenHidden = false;
286
-
287
- - anime.speed = .5;
288
- + engine.playbackRate = .5;
289
- ```
104
+ © [Julian Garnier](http://juliangarnier.com) | [MIT License](LICENSE.md)