animejs 4.0.1 → 4.0.2

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
@@ -56,12 +56,30 @@ animate('.square', {
56
56
 
57
57
  The full documentation is available [here](https://animejs.com/documentation).
58
58
 
59
+ ## V3 Migration guide
60
+
61
+ You can find the v3 to v4 migration guide [here](https://github.com/juliangarnier/anime/wiki/Migrating-from-v3-to-v4).
62
+
63
+ ## NPM development scripts
64
+
65
+ First, run `npm i` to install all the necessary packages.
66
+ Then, execute the following scripts with `npm run <script>`.
67
+
68
+ | script | action |
69
+ | ------ | ------ |
70
+ | `dev` | Watch any changes in `src/` and compiles the esm version to `lib/anime.esm.js` |
71
+ | `dev-types` | Same as `dev`, but also run TypeScript and generate the `types/index.d.ts` file |
72
+ | `build` | Generate types definition and compiles ESM / UMD / IIFE versions to `lib/` |
73
+ | `test-browser` | Start a local server and start all browser related tests |
74
+ | `test-node` | Start all Node related tests |
75
+ | `open-examples` | Start a local server to browse the examples locally |
76
+
59
77
  ## Our sponsors
60
78
 
61
79
  Anime.js is 100% free and is only made possible with the help of our sponsors.
62
80
  Help the project become sustainable by sponsoring us on <a target="_blank" href="https://github.com/sponsors/juliangarnier">GitHub Sponsors</a>.
63
81
 
64
- ## Platinum sponsors
82
+ ### Platinum sponsors
65
83
 
66
84
  <table>
67
85
  <tr>
@@ -103,187 +121,4 @@ Help the project become sustainable by sponsoring us on <a target="_blank" href=
103
121
  </tr>
104
122
  </table>
105
123
 
106
- ## NPM development scripts
107
-
108
- First, run `npm i` to install all the necessary packages.
109
- Then, execute the following scripts with `npm run <script>`.
110
-
111
- | script | action |
112
- | ------ | ------ |
113
- | `dev` | Watch any changes in `src/` and compiles the esm version to `lib/anime.esm.js` |
114
- | `dev-types` | Same as `dev`, but also run TypeScript and generate the `types/index.d.ts` file |
115
- | `build` | Generate types definition and compiles ESM / UMD / IIFE versions to `lib/` |
116
- | `test-browser` | Start a local server and start all browser related tests |
117
- | `test-node` | Start all Node related tests |
118
- | `open-examples` | Start a local server to browse the examples locally |
119
-
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
- ```
124
+ © [Julian Garnier](http://juliangarnier.com) | [MIT License](LICENSE.md)