animejs 2.0.0 → 2.2.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 +94 -96
- package/anime.js +236 -113
- package/anime.min.js +29 -23
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# [anime.js](http://
|
|
1
|
+
# [anime.js](http://animejs.com) 
|
|
2
2
|
|
|
3
|
-
<img src="documentation/assets/img/readme/animejs-logo.gif" width="100%" />
|
|
3
|
+
<img src="http://animejs.com/documentation/assets/img/readme/animejs-logo.gif" width="100%" />
|
|
4
4
|
|
|
5
5
|
>*Anime* `(/ˈæn.ə.meɪ/)` is a lightweight JavaScript animation library. It works with any CSS Properties, individual CSS transforms, SVG or any DOM attributes, and JavaScript Objects.
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
* [CodePen demos and examples](http://codepen.io/collection/b392d3a52d6abf5b8d9fda4e4cab61ab/)
|
|
22
22
|
* [juliangarnier.com](http://juliangarnier.com)
|
|
23
|
-
* [
|
|
23
|
+
* [animejs.com](http://animejs.com)
|
|
24
24
|
* [kenzo.com/en/thejunglebook](https://kenzo.com/en/thejunglebook)
|
|
25
25
|
* [Stress test](http://codepen.io/juliangarnier/pen/9aea7f045d7db301eab41bc09dcfc04d?editors=0010)
|
|
26
26
|
|
|
@@ -72,13 +72,13 @@ The `targets` property defines the elements or JS `Object`s to animate.
|
|
|
72
72
|
|
|
73
73
|
| Types | Examples
|
|
74
74
|
| --- | ---
|
|
75
|
-
| CSS Selectors | `'div'`, `'.item'`, `'path'`
|
|
75
|
+
| CSS Selectors | `'div'`, `'.item'`, `'path'`, `'#el path'` ...
|
|
76
76
|
| DOM Element | `document.querySelector('.item')`
|
|
77
77
|
| NodeList | `document.querySelectorAll('.item')`
|
|
78
78
|
| `Object` | `{prop1: 100, prop2: 200}`
|
|
79
79
|
| `Array` | `['div', '.item', domNode]`
|
|
80
80
|
|
|
81
|
-
➜ [Targets examples](http://
|
|
81
|
+
➜ [Targets examples](http://animejs.com/documentation/#cssSelector)
|
|
82
82
|
|
|
83
83
|
## Animatable properties
|
|
84
84
|
|
|
@@ -90,11 +90,11 @@ The `targets` property defines the elements or JS `Object`s to animate.
|
|
|
90
90
|
| DOM attributes | Any DOM attributes containing numerical values
|
|
91
91
|
| SVG attributes | Any SVG attributes containing numerical values
|
|
92
92
|
|
|
93
|
-
➜ [Animatable properties examples](http://
|
|
93
|
+
➜ [Animatable properties examples](http://animejs.com/documentation/#cssProperties)
|
|
94
94
|
|
|
95
95
|
### CSS
|
|
96
96
|
|
|
97
|
-
<img src="documentation/assets/img/readme/prop-css.gif" width="332" />
|
|
97
|
+
<img src="http://animejs.com/documentation/assets/img/readme/prop-css.gif" width="332" />
|
|
98
98
|
|
|
99
99
|
Any CSS properties can be animated:
|
|
100
100
|
|
|
@@ -107,11 +107,11 @@ anime({
|
|
|
107
107
|
});
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
➜ [CSS properties example](http://
|
|
110
|
+
➜ [CSS properties example](http://animejs.com/documentation/#cssProperties)
|
|
111
111
|
|
|
112
112
|
### Individual CSS transforms
|
|
113
113
|
|
|
114
|
-
<img src="documentation/assets/img/readme/prop-transforms.gif" width="332" />
|
|
114
|
+
<img src="http://animejs.com/documentation/assets/img/readme/prop-transforms.gif" width="332" />
|
|
115
115
|
|
|
116
116
|
CSS transforms can be animated individually:
|
|
117
117
|
|
|
@@ -119,16 +119,16 @@ CSS transforms can be animated individually:
|
|
|
119
119
|
anime({
|
|
120
120
|
targets: 'div',
|
|
121
121
|
translateX: 250, // Animate all divs translateX property to 250px
|
|
122
|
-
scale: 2, // Animate all divs scale to
|
|
122
|
+
scale: 2, // Animate all divs scale to 2
|
|
123
123
|
rotate: '1turn' // Animate all divs rotation to 1 turn
|
|
124
124
|
});
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
➜ [CSS Transforms example](http://
|
|
127
|
+
➜ [CSS Transforms example](http://animejs.com/documentation/#CSStransforms)
|
|
128
128
|
|
|
129
129
|
### JavaScript Object properties
|
|
130
130
|
|
|
131
|
-
<img src="documentation/assets/img/readme/prop-js-obj.gif" width="332" />
|
|
131
|
+
<img src="http://animejs.com/documentation/assets/img/readme/prop-js-obj.gif" width="332" />
|
|
132
132
|
|
|
133
133
|
Any `Object` property containing a numerical value can be animated:
|
|
134
134
|
|
|
@@ -145,11 +145,11 @@ anime({
|
|
|
145
145
|
});
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
➜ [Object properties example](http://
|
|
148
|
+
➜ [Object properties example](http://animejs.com/documentation/#JSobjectProp)
|
|
149
149
|
|
|
150
150
|
### DOM Attributes
|
|
151
151
|
|
|
152
|
-
<img src="documentation/assets/img/readme/prop-dom-attr.gif" width="332" />
|
|
152
|
+
<img src="http://animejs.com/documentation/assets/img/readme/prop-dom-attr.gif" width="332" />
|
|
153
153
|
|
|
154
154
|
Any DOM Attribute containing a numerical values can be animated:
|
|
155
155
|
|
|
@@ -165,11 +165,11 @@ anime({
|
|
|
165
165
|
});
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
➜ [DOM Attributes example](http://
|
|
168
|
+
➜ [DOM Attributes example](http://animejs.com/documentation/#domAttributes)
|
|
169
169
|
|
|
170
170
|
### SVG Attributes
|
|
171
171
|
|
|
172
|
-
<img src="documentation/assets/img/readme/prop-svg-attr.gif" width="332" />
|
|
172
|
+
<img src="http://animejs.com/documentation/assets/img/readme/prop-svg-attr.gif" width="332" />
|
|
173
173
|
|
|
174
174
|
Any SVG Attribute containing a numerical values can be animated:
|
|
175
175
|
|
|
@@ -186,11 +186,11 @@ anime({
|
|
|
186
186
|
});
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
➜ [SVG Attributes example](http://
|
|
189
|
+
➜ [SVG Attributes example](http://animejs.com/documentation/#svgAttributes)
|
|
190
190
|
|
|
191
191
|
## Property parameters
|
|
192
192
|
|
|
193
|
-
<img src="documentation/assets/img/readme/prop-parameters.gif" width="332" />
|
|
193
|
+
<img src="http://animejs.com/documentation/assets/img/readme/prop-parameters.gif" width="332" />
|
|
194
194
|
|
|
195
195
|
Defines duration, delay and easing for each property animations.<br>
|
|
196
196
|
Can be set globally, or individually to each properties:
|
|
@@ -224,11 +224,11 @@ anime({
|
|
|
224
224
|
});
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
➜ [Property parameters examples](http://
|
|
227
|
+
➜ [Property parameters examples](http://animejs.com/documentation/#duration)
|
|
228
228
|
|
|
229
229
|
## Function based property parameters
|
|
230
230
|
|
|
231
|
-
<img src="documentation/assets/img/readme/fb-parameters.gif" width="332" />
|
|
231
|
+
<img src="http://animejs.com/documentation/assets/img/readme/fb-parameters.gif" width="332" />
|
|
232
232
|
|
|
233
233
|
Get different property parameters for every target of the animation.<br>
|
|
234
234
|
The function accepts 3 arguments: `target`, `index`, `targetsLength`.
|
|
@@ -236,7 +236,6 @@ The function accepts 3 arguments: `target`, `index`, `targetsLength`.
|
|
|
236
236
|
```javascript
|
|
237
237
|
anime({
|
|
238
238
|
targets: 'div',
|
|
239
|
-
translateX: 100,
|
|
240
239
|
translateX: 250,
|
|
241
240
|
rotate: 180,
|
|
242
241
|
duration: function(target) {
|
|
@@ -254,11 +253,11 @@ anime({
|
|
|
254
253
|
});
|
|
255
254
|
```
|
|
256
255
|
|
|
257
|
-
➜ [Function based parameters examples](http://
|
|
256
|
+
➜ [Function based parameters examples](http://animejs.com/documentation/#functionBasedDuration)
|
|
258
257
|
|
|
259
258
|
## Animation parameters
|
|
260
259
|
|
|
261
|
-
<img src="documentation/assets/img/readme/anim-parameters.gif" width="332" />
|
|
260
|
+
<img src="http://animejs.com/documentation/assets/img/readme/anim-parameters.gif" width="332" />
|
|
262
261
|
|
|
263
262
|
Parameters relative to the animation to specify the direction, the number of loops or autoplay.
|
|
264
263
|
|
|
@@ -274,12 +273,12 @@ anime({
|
|
|
274
273
|
translateX: 100,
|
|
275
274
|
duration: 2000,
|
|
276
275
|
loop: 3, // Play the animation 3 times
|
|
277
|
-
direction: 'reverse' // Play the animation in reverse
|
|
276
|
+
direction: 'reverse', // Play the animation in reverse
|
|
278
277
|
autoplay: false // Animation paused by default
|
|
279
278
|
});
|
|
280
279
|
```
|
|
281
280
|
|
|
282
|
-
➜ [Animation parameters examples](http://
|
|
281
|
+
➜ [Animation parameters examples](http://animejs.com/documentation/#alternate)
|
|
283
282
|
|
|
284
283
|
## Property values
|
|
285
284
|
|
|
@@ -291,11 +290,11 @@ Start value is the original target value, or default transforms value.
|
|
|
291
290
|
| Types | Examples | Infos
|
|
292
291
|
| --- | --- | ---
|
|
293
292
|
| Number | `100` | Automatically add original or default unit if needed
|
|
294
|
-
| String | `'10em'`, `'1turn'`, `'M21 1v160'` | Must contains at least one numerical value
|
|
293
|
+
| String | `'10em'`, `'1turn'`, `'M21 1v160'`, `'50%'` | Must contains at least one numerical value
|
|
295
294
|
| Relative values | `'+=100px'`, `'-=20em'`, `'*=4'` | Add, subtract or multiply the original property value
|
|
296
295
|
| Colors | `'#FFF'`, `'rgb(255,0,0)'`, `'hsl(100, 20%, 80%)'` | Accepts 3 or 6 hex digit, rgb, or hsl values
|
|
297
296
|
|
|
298
|
-
➜ [Values examples](http://
|
|
297
|
+
➜ [Values examples](http://animejs.com/documentation/#unitlessValue)
|
|
299
298
|
|
|
300
299
|
```javascript
|
|
301
300
|
anime({
|
|
@@ -310,7 +309,7 @@ anime({
|
|
|
310
309
|
|
|
311
310
|
### From > To values
|
|
312
311
|
|
|
313
|
-
<img src="documentation/assets/img/readme/value-from-to.gif" width="332" />
|
|
312
|
+
<img src="http://animejs.com/documentation/assets/img/readme/value-from-to.gif" width="332" />
|
|
314
313
|
|
|
315
314
|
Force the animation to start at a certain value.
|
|
316
315
|
|
|
@@ -325,14 +324,14 @@ anime({
|
|
|
325
324
|
});
|
|
326
325
|
```
|
|
327
326
|
|
|
328
|
-
➜ [Specific initial value example](http://
|
|
327
|
+
➜ [Specific initial value example](http://animejs.com/documentation/#specificInitialValue)
|
|
329
328
|
|
|
330
329
|
### Function based values
|
|
331
330
|
|
|
332
|
-
<img src="documentation/assets/img/readme/value-fb.gif" width="332" />
|
|
331
|
+
<img src="http://animejs.com/documentation/assets/img/readme/value-fb.gif" width="332" />
|
|
333
332
|
|
|
334
333
|
Same as [function based property parameters](#function-based-property-parameters).<br>
|
|
335
|
-
Get different values for every target of the animation.<br>
|
|
334
|
+
Get different values for every target and property of the animation.<br>
|
|
336
335
|
The function accepts 3 arguments: `target`, `index`, `targetsLength`.
|
|
337
336
|
|
|
338
337
|
```javascript
|
|
@@ -348,17 +347,16 @@ anime({
|
|
|
348
347
|
return (l - i) + .25;
|
|
349
348
|
},
|
|
350
349
|
rotate: function() { return anime.random(-360, 360); },
|
|
351
|
-
duration: function() { return anime.random(1200, 1800); },
|
|
352
350
|
duration: function() { return anime.random(800, 1600); },
|
|
353
351
|
delay: function() { return anime.random(0, 1000); }
|
|
354
352
|
});
|
|
355
353
|
```
|
|
356
354
|
|
|
357
|
-
➜ [Function based value example](http://
|
|
355
|
+
➜ [Function based value example](http://animejs.com/documentation/#functionBasedPropVal)
|
|
358
356
|
|
|
359
357
|
### Keyframes
|
|
360
358
|
|
|
361
|
-
<img src="documentation/assets/img/readme/value-keyframes.gif" width="332" />
|
|
359
|
+
<img src="http://animejs.com/documentation/assets/img/readme/value-keyframes.gif" width="332" />
|
|
362
360
|
|
|
363
361
|
Keyframes are defined using an `Array` of property Object.<br>
|
|
364
362
|
Instance's `duration` is divided by the number of keyframes of each properties if not specified.
|
|
@@ -391,13 +389,13 @@ anime({
|
|
|
391
389
|
});
|
|
392
390
|
```
|
|
393
391
|
|
|
394
|
-
➜ [Specific keyframes properties example](http://
|
|
392
|
+
➜ [Specific keyframes properties example](http://animejs.com/documentation/#keyframes)
|
|
395
393
|
|
|
396
394
|
## Timeline
|
|
397
395
|
|
|
398
396
|
### Basic timeline
|
|
399
397
|
|
|
400
|
-
<img src="documentation/assets/img/readme/timeline.gif" width="332" />
|
|
398
|
+
<img src="http://animejs.com/documentation/assets/img/readme/timeline.gif" width="332" />
|
|
401
399
|
|
|
402
400
|
Play animations in sequence by creating a timeline:
|
|
403
401
|
|
|
@@ -435,7 +433,7 @@ myTimeline
|
|
|
435
433
|
|
|
436
434
|
Access timeline children animations with `myTimeline.children`
|
|
437
435
|
|
|
438
|
-
➜ [Basic timeline example](http://
|
|
436
|
+
➜ [Basic timeline example](http://animejs.com/documentation/#basicTimeline)
|
|
439
437
|
|
|
440
438
|
### Timeline animations offsets
|
|
441
439
|
|
|
@@ -443,15 +441,15 @@ Access timeline children animations with `myTimeline.children`
|
|
|
443
441
|
|
|
444
442
|
#### Relative offset
|
|
445
443
|
|
|
446
|
-
<img src="documentation/assets/img/readme/timeline-relative.gif" width="332" />
|
|
444
|
+
<img src="http://animejs.com/documentation/assets/img/readme/timeline-relative.gif" width="332" />
|
|
447
445
|
|
|
448
446
|
Defines starting time relative to the previous animations duration.
|
|
449
447
|
|
|
450
|
-
| Types | Examples | Infos
|
|
451
|
-
| --- | --- | ---
|
|
452
|
-
| `+=` | `'+=100'` | Starts 100ms after the previous animation ends
|
|
453
|
-
| `-=` | `'-=100'` | Starts 100ms before the previous animation ends
|
|
454
|
-
| `*=` | `'*=2'` | Starts at 2 times the previous animations duration
|
|
448
|
+
| Types | Examples | Infos
|
|
449
|
+
| --- | --- | ---
|
|
450
|
+
| `+=` | `'+=100'` | Starts 100ms after the previous animation ends
|
|
451
|
+
| `-=` | `'-=100'` | Starts 100ms before the previous animation ends
|
|
452
|
+
| `*=` | `'*=2'` | Starts at 2 times the previous animations duration
|
|
455
453
|
|
|
456
454
|
```javascript
|
|
457
455
|
myTimeline
|
|
@@ -471,11 +469,11 @@ myTimeline
|
|
|
471
469
|
});
|
|
472
470
|
```
|
|
473
471
|
|
|
474
|
-
➜ [Relative offset example](http://
|
|
472
|
+
➜ [Relative offset example](http://animejs.com/documentation/#relativeOffset)
|
|
475
473
|
|
|
476
474
|
#### Absolute offset
|
|
477
475
|
|
|
478
|
-
<img src="documentation/assets/img/readme/timeline-absolute.gif" width="332" />
|
|
476
|
+
<img src="http://animejs.com/documentation/assets/img/readme/timeline-absolute.gif" width="332" />
|
|
479
477
|
|
|
480
478
|
Defines an absolute starting time on the timeline with a number.
|
|
481
479
|
|
|
@@ -498,7 +496,7 @@ myTimeline
|
|
|
498
496
|
});
|
|
499
497
|
```
|
|
500
498
|
|
|
501
|
-
➜ [Absolute offset example](http://
|
|
499
|
+
➜ [Absolute offset example](http://animejs.com/documentation/absoluteOffset)
|
|
502
500
|
|
|
503
501
|
## Playback controls
|
|
504
502
|
|
|
@@ -506,7 +504,7 @@ Play, pause, restart, seek animations or timelines.
|
|
|
506
504
|
|
|
507
505
|
### Play / Pause
|
|
508
506
|
|
|
509
|
-
<img src="documentation/assets/img/readme/playback-play-pause.gif" width="332" />
|
|
507
|
+
<img src="http://animejs.com/documentation/assets/img/readme/playback-play-pause.gif" width="332" />
|
|
510
508
|
|
|
511
509
|
```javascript
|
|
512
510
|
var playPauseAnim = anime({
|
|
@@ -521,11 +519,11 @@ playPauseAnim.play(); // Manually play
|
|
|
521
519
|
playPauseAnim.pause(); // Manually pause
|
|
522
520
|
```
|
|
523
521
|
|
|
524
|
-
➜ [Play / Pause example](http://
|
|
522
|
+
➜ [Play / Pause example](http://animejs.com/documentation/#playPause)
|
|
525
523
|
|
|
526
524
|
### Restart
|
|
527
525
|
|
|
528
|
-
<img src="documentation/assets/img/readme/playback-restart.gif" width="332" />
|
|
526
|
+
<img src="http://animejs.com/documentation/assets/img/readme/playback-restart.gif" width="332" />
|
|
529
527
|
|
|
530
528
|
```javascript
|
|
531
529
|
var restartAnim = anime({
|
|
@@ -539,28 +537,28 @@ var restartAnim = anime({
|
|
|
539
537
|
restartAnim.restart(); // Restart the animation and reset the loop count / current direction
|
|
540
538
|
```
|
|
541
539
|
|
|
542
|
-
➜ [Restart example](http://
|
|
540
|
+
➜ [Restart example](http://animejs.com/documentation/#restartAnim)
|
|
543
541
|
|
|
544
542
|
### Reverse
|
|
545
543
|
|
|
546
|
-
<img src="documentation/assets/img/readme/playback-reverse.gif" width="332" />
|
|
544
|
+
<img src="http://animejs.com/documentation/assets/img/readme/playback-reverse.gif" width="332" />
|
|
547
545
|
|
|
548
546
|
```javascript
|
|
549
|
-
var
|
|
547
|
+
var reverseAnim = anime({
|
|
550
548
|
targets: 'div',
|
|
551
549
|
translateX: 250,
|
|
552
550
|
direction: 'alternate',
|
|
553
551
|
loop: true
|
|
554
552
|
});
|
|
555
553
|
|
|
556
|
-
|
|
554
|
+
reverseAnim.reverse(); // Change the animation direction
|
|
557
555
|
```
|
|
558
556
|
|
|
559
|
-
➜ [Reverse example](http://
|
|
557
|
+
➜ [Reverse example](http://animejs.com/documentation/#reverseAnim)
|
|
560
558
|
|
|
561
559
|
### Seek
|
|
562
560
|
|
|
563
|
-
<img src="documentation/assets/img/readme/playback-seek.gif" width="332" />
|
|
561
|
+
<img src="http://animejs.com/documentation/assets/img/readme/playback-seek.gif" width="332" />
|
|
564
562
|
|
|
565
563
|
Change animations or timelines current time.
|
|
566
564
|
|
|
@@ -576,11 +574,11 @@ var seekAnim = anime({
|
|
|
576
574
|
seekAnim.seek(500); // Set the animation current time to 500ms
|
|
577
575
|
```
|
|
578
576
|
|
|
579
|
-
➜ [Seek example](http://
|
|
577
|
+
➜ [Seek example](http://animejs.com/documentation/#seekAnim)
|
|
580
578
|
|
|
581
579
|
## Callbacks
|
|
582
580
|
|
|
583
|
-
<img src="documentation/assets/img/readme/callbacks-all.gif" width="332" />
|
|
581
|
+
<img src="http://animejs.com/documentation/assets/img/readme/callbacks-all.gif" width="332" />
|
|
584
582
|
|
|
585
583
|
Execute a function at the beginning, during or when an animation or timeline is completed.
|
|
586
584
|
|
|
@@ -590,7 +588,7 @@ Execute a function at the beginning, during or when an animation or timeline is
|
|
|
590
588
|
| begin | `function` | animation `Object` | Called after animation delay is over
|
|
591
589
|
| complete | `function` | animation `Object` | Called only after all the loops are completed
|
|
592
590
|
|
|
593
|
-
➜ [Callbacks examples](http://
|
|
591
|
+
➜ [Callbacks examples](http://animejs.com/documentation/#allCallbacks)
|
|
594
592
|
|
|
595
593
|
### Update
|
|
596
594
|
|
|
@@ -598,7 +596,7 @@ Execute a function at the beginning, during or when an animation or timeline is
|
|
|
598
596
|
|
|
599
597
|
```javascript
|
|
600
598
|
var myAnimation = anime({
|
|
601
|
-
targets: '#
|
|
599
|
+
targets: '#update .el',
|
|
602
600
|
translateX: 250,
|
|
603
601
|
delay: 1000,
|
|
604
602
|
update: function(anim) {
|
|
@@ -608,7 +606,7 @@ var myAnimation = anime({
|
|
|
608
606
|
});
|
|
609
607
|
```
|
|
610
608
|
|
|
611
|
-
➜ [Update example](http://
|
|
609
|
+
➜ [Update example](http://animejs.com/documentation/#update)
|
|
612
610
|
|
|
613
611
|
### Begin
|
|
614
612
|
|
|
@@ -627,7 +625,7 @@ var myAnimation = anime({
|
|
|
627
625
|
|
|
628
626
|
Check if the animation has begun with `myAnimation.began`, return `true` or `false`.
|
|
629
627
|
|
|
630
|
-
➜ [Begin example](http://
|
|
628
|
+
➜ [Begin example](http://animejs.com/documentation/#begin)
|
|
631
629
|
|
|
632
630
|
### Run
|
|
633
631
|
|
|
@@ -635,7 +633,7 @@ Check if the animation has begun with `myAnimation.began`, return `true` or `fal
|
|
|
635
633
|
|
|
636
634
|
```javascript
|
|
637
635
|
var myAnimation = anime({
|
|
638
|
-
targets: '#
|
|
636
|
+
targets: '#run .el',
|
|
639
637
|
translateX: 250,
|
|
640
638
|
delay: 1000,
|
|
641
639
|
run: function(anim) {
|
|
@@ -644,7 +642,7 @@ var myAnimation = anime({
|
|
|
644
642
|
});
|
|
645
643
|
```
|
|
646
644
|
|
|
647
|
-
➜ [Run example](http://
|
|
645
|
+
➜ [Run example](http://animejs.com/documentation/#run)
|
|
648
646
|
|
|
649
647
|
### Complete
|
|
650
648
|
|
|
@@ -654,7 +652,7 @@ var myAnimation = anime({
|
|
|
654
652
|
var myAnimation = anime({
|
|
655
653
|
targets: '#complete .el',
|
|
656
654
|
translateX: 250,
|
|
657
|
-
|
|
655
|
+
complete: function(anim) {
|
|
658
656
|
console.log(anim.completed);
|
|
659
657
|
}
|
|
660
658
|
});
|
|
@@ -662,19 +660,19 @@ var myAnimation = anime({
|
|
|
662
660
|
|
|
663
661
|
Check if the animation has finished with `myAnimation.completed`, return `true` or `false`.
|
|
664
662
|
|
|
665
|
-
➜ [Complete example](http://
|
|
663
|
+
➜ [Complete example](http://animejs.com/documentation/#complete)
|
|
666
664
|
|
|
667
665
|
## Promises
|
|
668
666
|
|
|
669
667
|
`myAnimation.finished` returns a Promise object which will resolve once the animation has finished running.
|
|
670
668
|
|
|
671
|
-
➜ [Promises example](http://
|
|
669
|
+
➜ [Promises example](http://animejs.com/documentation/#finishedPromise)
|
|
672
670
|
|
|
673
671
|
## SVG
|
|
674
672
|
|
|
675
673
|
### Motion path
|
|
676
674
|
|
|
677
|
-
<img src="documentation/assets/img/readme/svg-motion-path.gif" width="332" />
|
|
675
|
+
<img src="http://animejs.com/documentation/assets/img/readme/svg-motion-path.gif" width="332" />
|
|
678
676
|
|
|
679
677
|
Translate and rotate DOM elements along an SVG path:
|
|
680
678
|
|
|
@@ -690,16 +688,16 @@ var motionPath = anime({
|
|
|
690
688
|
});
|
|
691
689
|
```
|
|
692
690
|
|
|
693
|
-
➜ [Motion path example](http://
|
|
691
|
+
➜ [Motion path example](http://animejs.com/documentation/#motionPath)
|
|
694
692
|
|
|
695
693
|
### Morphing
|
|
696
694
|
|
|
697
|
-
<img src="documentation/assets/img/readme/svg-morphing.gif" width="332" />
|
|
695
|
+
<img src="http://animejs.com/documentation/assets/img/readme/svg-morphing.gif" width="332" />
|
|
698
696
|
|
|
699
697
|
Animate the transition between two SVG shapes:
|
|
700
698
|
|
|
701
699
|
```html
|
|
702
|
-
<svg class="
|
|
700
|
+
<svg class="shape" width="128" height="128" viewBox="0 0 128 128">
|
|
703
701
|
<polygon points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100"></polygon>
|
|
704
702
|
</svg>
|
|
705
703
|
```
|
|
@@ -713,22 +711,22 @@ var svgAttributes = anime({
|
|
|
713
711
|
|
|
714
712
|
Shapes need to have the same number of points.
|
|
715
713
|
|
|
716
|
-
➜ [Morphing example](http://
|
|
714
|
+
➜ [Morphing example](http://animejs.com/documentation/#morphing)
|
|
717
715
|
|
|
718
716
|
### Line drawing
|
|
719
717
|
|
|
720
|
-
<img src="documentation/assets/img/readme/svg-line-drawing.gif" width="332" />
|
|
718
|
+
<img src="http://animejs.com/documentation/assets/img/readme/svg-line-drawing.gif" width="332" />
|
|
721
719
|
|
|
722
720
|
Line drawing animation of an SVG shape:
|
|
723
721
|
|
|
724
722
|
```javascript
|
|
725
723
|
anime({
|
|
726
724
|
targets: '.shape path',
|
|
727
|
-
|
|
725
|
+
strokeDashoffset: [anime.setDashoffset, 0]
|
|
728
726
|
});
|
|
729
727
|
```
|
|
730
728
|
|
|
731
|
-
➜ [Line drawing example](http://
|
|
729
|
+
➜ [Line drawing example](http://animejs.com/documentation/#lineDrawing)
|
|
732
730
|
|
|
733
731
|
## Easing functions
|
|
734
732
|
|
|
@@ -757,15 +755,15 @@ Penner's equations:
|
|
|
757
755
|
| easeInBack | easeOutBack | easeInOutBack
|
|
758
756
|
| easeInElastic | easeOutElastic | easeInOutElastic
|
|
759
757
|
|
|
760
|
-
➜ [Built in easing functions examples](http://
|
|
758
|
+
➜ [Built in easing functions examples](http://animejs.com/documentation/#penner)
|
|
761
759
|
|
|
762
760
|
Usage:
|
|
763
761
|
|
|
764
762
|
```javascript
|
|
765
763
|
anime({
|
|
766
764
|
targets: 'div',
|
|
767
|
-
|
|
768
|
-
|
|
765
|
+
translateX: 100,
|
|
766
|
+
easing: 'easeOutExpo' // Default 'easeOutElastic'
|
|
769
767
|
});
|
|
770
768
|
```
|
|
771
769
|
|
|
@@ -774,13 +772,13 @@ Elasticity of Elastic easings can be configured with the `elasticity` parameters
|
|
|
774
772
|
```javascript
|
|
775
773
|
anime({
|
|
776
774
|
targets: 'div',
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
775
|
+
translateX: 100,
|
|
776
|
+
easing: 'easeOutElastic',
|
|
777
|
+
elasticity: 600 // Default 500, range [0-1000]
|
|
780
778
|
});
|
|
781
779
|
```
|
|
782
780
|
|
|
783
|
-
➜ [Elasticity examples](http://
|
|
781
|
+
➜ [Elasticity examples](http://animejs.com/documentation/#elasticity)
|
|
784
782
|
|
|
785
783
|
### Custom Bézier curves
|
|
786
784
|
|
|
@@ -789,14 +787,14 @@ Define a Bézier curve with an `Array` of 4 coordinates:
|
|
|
789
787
|
```javascript
|
|
790
788
|
anime({
|
|
791
789
|
targets: 'div',
|
|
792
|
-
|
|
793
|
-
|
|
790
|
+
translateX: 100,
|
|
791
|
+
easing: [.91,-0.54,.29,1.56]
|
|
794
792
|
});
|
|
795
793
|
```
|
|
796
794
|
|
|
797
|
-
Custom Bézier curves coordinates can be generated here https://matthewlein.com/ceaser
|
|
795
|
+
Custom Bézier curves coordinates can be generated here <https://matthewlein.com/ceaser/>
|
|
798
796
|
|
|
799
|
-
➜ [Custom Bézier curves example](http://
|
|
797
|
+
➜ [Custom Bézier curves example](http://animejs.com/documentation/#customBezier)
|
|
800
798
|
|
|
801
799
|
### Defining custom functions
|
|
802
800
|
|
|
@@ -811,8 +809,8 @@ anime.easings['myCustomEasingName'] = function(t) {
|
|
|
811
809
|
// Usage
|
|
812
810
|
anime({
|
|
813
811
|
targets: 'div',
|
|
814
|
-
|
|
815
|
-
|
|
812
|
+
translateX: 100,
|
|
813
|
+
easing: 'myCustomEasingName'
|
|
816
814
|
});
|
|
817
815
|
|
|
818
816
|
// add custom Bézier curve function
|
|
@@ -821,12 +819,12 @@ anime.easings['myCustomCurve'] = anime.bezier([.91,-0.54,.29,1.56]);
|
|
|
821
819
|
// Usage
|
|
822
820
|
anime({
|
|
823
821
|
targets: 'div',
|
|
824
|
-
|
|
825
|
-
|
|
822
|
+
translateX: 100,
|
|
823
|
+
easing: 'myCustomCurve'
|
|
826
824
|
});
|
|
827
825
|
```
|
|
828
826
|
|
|
829
|
-
➜ [Custom easing functions example](http://
|
|
827
|
+
➜ [Custom easing functions example](http://animejs.com/documentation/#customEasingFunction)
|
|
830
828
|
|
|
831
829
|
## Helpers
|
|
832
830
|
|
|
@@ -851,7 +849,7 @@ anime.running;
|
|
|
851
849
|
Remove one or multiple targets from the animation.
|
|
852
850
|
|
|
853
851
|
```javascript
|
|
854
|
-
anime.remove('.item-2'); // Remove all
|
|
852
|
+
anime.remove('.item-2'); // Remove all elements with the class 'item-2'
|
|
855
853
|
```
|
|
856
854
|
|
|
857
855
|
### anime.getValue(target, property)
|
|
@@ -871,7 +869,7 @@ Accepts either a DOM node or CSS selector.
|
|
|
871
869
|
var path = anime.path('svg path', 'translateX'); // Return path(attribute)
|
|
872
870
|
```
|
|
873
871
|
|
|
874
|
-
➜ [Motion path example](http://
|
|
872
|
+
➜ [Motion path example](http://animejs.com/documentation/#motionPath)
|
|
875
873
|
|
|
876
874
|
### anime.setDashoffset(pathEl)
|
|
877
875
|
|
|
@@ -881,11 +879,11 @@ Sets the 'stroke-dasharray' to the total path length and return its value.
|
|
|
881
879
|
```javascript
|
|
882
880
|
anime({
|
|
883
881
|
targets: '.shape path',
|
|
884
|
-
|
|
882
|
+
strokeDashoffset: [anime.pathDashoffset, 0]
|
|
885
883
|
});
|
|
886
884
|
```
|
|
887
885
|
|
|
888
|
-
➜ [Line drawing example](http://
|
|
886
|
+
➜ [Line drawing example](http://animejs.com/documentation/#lineDrawing)
|
|
889
887
|
|
|
890
888
|
### anime.easings
|
|
891
889
|
|
|
@@ -912,7 +910,7 @@ var timeline = anime.timeline();
|
|
|
912
910
|
timeline.add([instance1, instance2, ...]);
|
|
913
911
|
```
|
|
914
912
|
|
|
915
|
-
➜ [Timeline examples](http://
|
|
913
|
+
➜ [Timeline examples](http://animejs.com/documentation/#basicTimeline)
|
|
916
914
|
|
|
917
915
|
### anime.random(x, y)
|
|
918
916
|
|
|
@@ -926,4 +924,4 @@ anime.random(10, 40); // Will return a random number between 10 and 40
|
|
|
926
924
|
|
|
927
925
|
[MIT License](LICENSE.md). © 2017 [Julian Garnier](http://juliangarnier.com).
|
|
928
926
|
|
|
929
|
-
Thanks to [Animate Plus](https://github.com/bendc/animateplus) and [Velocity](https://github.com/julianshapiro/velocity) that inspired `anime.js` API, [BezierEasing](https://github.com/gre/bezier-easing) and [jQuery UI](https://jqueryui.com/) for the easing system. [Tim Branyen](https://github.com/tbranyen) For the Promise implementation.
|
|
927
|
+
Thanks to [Animate Plus](https://github.com/bendc/animateplus) and [Velocity](https://github.com/julianshapiro/velocity) that inspired `anime.js` API, [BezierEasing](https://github.com/gre/bezier-easing) and [jQuery UI](https://jqueryui.com/) for the easing system. [Tim Branyen](https://github.com/tbranyen) For the Promise implementation.
|