@lottiefiles/dotlottie-web 0.77.1 → 0.78.1
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 +32 -2
- package/dist/dotlottie-player.wasm +0 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -10
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +42 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/webgl/dotlottie-player.wasm +0 -0
- package/dist/webgl/index.cjs +2 -2
- package/dist/webgl/index.cjs.map +1 -1
- package/dist/webgl/index.d.cts +24 -5
- package/dist/webgl/index.d.cts.map +1 -1
- package/dist/webgl/index.d.ts +37 -20
- package/dist/webgl/index.d.ts.map +1 -1
- package/dist/webgl/index.js +2 -2
- package/dist/webgl/index.js.map +1 -1
- package/dist/webgpu/dotlottie-player.wasm +0 -0
- package/dist/webgpu/index.cjs +2 -2
- package/dist/webgpu/index.cjs.map +1 -1
- package/dist/webgpu/index.d.cts +24 -5
- package/dist/webgpu/index.d.cts.map +1 -1
- package/dist/webgpu/index.d.ts +37 -20
- package/dist/webgpu/index.d.ts.map +1 -1
- package/dist/webgpu/index.js +2 -2
- package/dist/webgpu/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @lottiefiles/dotlottie-web
|
|
2
2
|
|
|
3
|
+
> [!TIP]
|
|
4
|
+
> Looking for animations to use with this player? Browse **[100,000+ free Lottie animations](https://lottiefiles.com/free-animations?utm_source=npm&utm_medium=readme)** and grab any of them as `.lottie` or `.json`, or create your own with [Lottie Creator](https://lottiefiles.com/lottie-creator?utm_source=npm&utm_medium=readme).
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|

|
|
4
8
|

|
|
5
9
|

|
|
@@ -15,6 +19,7 @@
|
|
|
15
19
|
* [Introduction](#introduction)
|
|
16
20
|
* [What is dotLottie?](#what-is-dotlottie)
|
|
17
21
|
* [Documentation](#documentation)
|
|
22
|
+
* [Faster First Frame](#faster-first-frame)
|
|
18
23
|
* [Supported Platforms](#supported-platforms)
|
|
19
24
|
* [Browser Requirements](#browser-requirements)
|
|
20
25
|
* [Live Examples](#live-examples)
|
|
@@ -23,18 +28,43 @@
|
|
|
23
28
|
|
|
24
29
|
## Introduction
|
|
25
30
|
|
|
26
|
-
`@lottiefiles/dotlottie-web` is a JavaScript library for rendering [Lottie](https://lottiefiles.github.io/lottie-docs/) and [dotLottie](https://dotlottie
|
|
31
|
+
`@lottiefiles/dotlottie-web` is a JavaScript library for rendering [Lottie](https://lottiefiles.github.io/lottie-docs/) and [dotLottie](https://lottiefiles.com/dotlottie) animations in Node.js and web environments. It provides a simple and intuitive API for loading, playing, and controlling animations, as well as advanced features like interactivity and theming.
|
|
27
32
|
|
|
28
33
|
### What is dotLottie?
|
|
29
34
|
|
|
30
35
|
dotLottie is an open-source file format that bundles one or more Lottie animations along with their assets into a single, compressed .lottie file. It uses ZIP compression for efficient storage and distribution. The format also supports advanced features like interactivity and theming, making it a powerful tool for creating dynamic and interactive animations.
|
|
31
36
|
|
|
32
|
-
[Learn more about dotLottie](https://
|
|
37
|
+
[Learn more about dotLottie](https://lottiefiles.com/dotlottie).
|
|
33
38
|
|
|
34
39
|
## Documentation
|
|
35
40
|
|
|
36
41
|
To get started with `@lottiefiles/dotlottie-web`, follow the [documentation here](https://developers.lottiefiles.com/docs/dotlottie-player/dotlottie-web/).
|
|
37
42
|
|
|
43
|
+
## Faster First Frame
|
|
44
|
+
|
|
45
|
+
The player's WASM engine (\~500 KB compressed) is fetched from a CDN when the first player is constructed. To take that download off your first animation's critical path:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
import { DotLottie } from '@lottiefiles/dotlottie-web';
|
|
49
|
+
|
|
50
|
+
// At app or route load, before any player is constructed:
|
|
51
|
+
DotLottie.preload();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or let the browser start the download even earlier (`crossorigin` is required — without it the preloaded response can't be reused and the file downloads twice):
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
|
|
58
|
+
<link
|
|
59
|
+
rel="preload"
|
|
60
|
+
as="fetch"
|
|
61
|
+
crossorigin
|
|
62
|
+
href="https://cdn.jsdelivr.net/npm/@lottiefiles/dotlottie-web@0.77.1/dist/dotlottie-player.wasm"
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The version in the URL must match your installed package version — the player fetches a version-pinned URL, and a mismatch means the preload can't be reused. If you use `setWasmUrl()`, call it before `preload()` and point the preload tag at the same URL.
|
|
67
|
+
|
|
38
68
|
## Supported Platforms
|
|
39
69
|
|
|
40
70
|
`@lottiefiles/dotlottie-web` is an isomorphic library designed to work in both browser and Node.js environments. It supports Node.js version 18 and higher, as well as all major web browsers.
|
|
Binary file
|