@thorvg/lottie-player 1.0.0-pre28 → 1.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/LICENSE +1 -1
- package/README.md +88 -13
- package/dist/gl/lottie-player.cjs.js +2 -2
- package/dist/gl/lottie-player.cjs.js.map +1 -1
- package/dist/gl/lottie-player.esm.js +2 -2
- package/dist/gl/lottie-player.esm.js.map +1 -1
- package/dist/gl/lottie-player.js +2 -2
- package/dist/gl/lottie-player.js.map +1 -1
- package/dist/gl/thorvg.wasm +0 -0
- package/dist/gl-lite/lottie-player.cjs.js +2 -2
- package/dist/gl-lite/lottie-player.cjs.js.map +1 -1
- package/dist/gl-lite/lottie-player.esm.js +2 -2
- package/dist/gl-lite/lottie-player.esm.js.map +1 -1
- package/dist/gl-lite/lottie-player.js +2 -2
- package/dist/gl-lite/lottie-player.js.map +1 -1
- package/dist/gl-lite/thorvg.wasm +0 -0
- package/dist/lottie-player.cjs.js +2 -2
- package/dist/lottie-player.cjs.js.map +1 -1
- package/dist/lottie-player.d.ts +41 -2
- package/dist/lottie-player.esm.js +2 -2
- package/dist/lottie-player.esm.js.map +1 -1
- package/dist/lottie-player.js +2 -2
- package/dist/lottie-player.js.map +1 -1
- package/dist/sw/lottie-player.cjs.js +2 -2
- package/dist/sw/lottie-player.cjs.js.map +1 -1
- package/dist/sw/lottie-player.esm.js +2 -2
- package/dist/sw/lottie-player.esm.js.map +1 -1
- package/dist/sw/lottie-player.js +2 -2
- package/dist/sw/lottie-player.js.map +1 -1
- package/dist/sw/thorvg.wasm +0 -0
- package/dist/sw-lite/lottie-player.cjs.js +2 -2
- package/dist/sw-lite/lottie-player.cjs.js.map +1 -1
- package/dist/sw-lite/lottie-player.esm.js +2 -2
- package/dist/sw-lite/lottie-player.esm.js.map +1 -1
- package/dist/sw-lite/lottie-player.js +2 -2
- package/dist/sw-lite/lottie-player.js.map +1 -1
- package/dist/sw-lite/thorvg.wasm +0 -0
- package/dist/thorvg.wasm +0 -0
- package/dist/wg/lottie-player.cjs.js +4 -0
- package/dist/wg/lottie-player.cjs.js.map +1 -0
- package/dist/wg/lottie-player.esm.js +4 -0
- package/dist/wg/lottie-player.esm.js.map +1 -0
- package/dist/wg/lottie-player.js +4 -0
- package/dist/wg/lottie-player.js.map +1 -0
- package/dist/wg/thorvg.wasm +0 -0
- package/dist/wg-lite/lottie-player.cjs.js +4 -0
- package/dist/wg-lite/lottie-player.cjs.js.map +1 -0
- package/dist/wg-lite/lottie-player.esm.js +4 -0
- package/dist/wg-lite/lottie-player.esm.js.map +1 -0
- package/dist/wg-lite/lottie-player.js +4 -0
- package/dist/wg-lite/lottie-player.js.map +1 -0
- package/dist/wg-lite/thorvg.wasm +0 -0
- package/package.json +36 -25
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
[](https://www.npmjs.com/package/@thorvg/lottie-player)
|
|
2
|
-
|
|
3
1
|
# ThorVG for Web
|
|
4
2
|
<p align="center">
|
|
5
|
-
<img width="800" height="auto" src="https://github.com/thorvg/thorvg/blob/main/
|
|
3
|
+
<img width="800" height="auto" src="https://github.com/thorvg/thorvg.site/blob/main/readme/logo/512/thorvg-banner.png">
|
|
6
4
|
</p>
|
|
7
5
|
|
|
6
|
+
[](https://www.npmjs.com/package/@thorvg/lottie-player)
|
|
7
|
+
|
|
8
8
|
# @thorvg/lottie-player
|
|
9
9
|
|
|
10
10
|
A Lottie Player which uses [ThorVG](https://github.com/thorvg/thorvg) as a renderer, provides a web component for easily embedding and playing [Lottie](https://airbnb.io/lottie) animations.
|
|
@@ -21,6 +21,28 @@ A Lottie Player which uses [ThorVG](https://github.com/thorvg/thorvg) as a rende
|
|
|
21
21
|
npm install @thorvg/lottie-player
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Contents
|
|
25
|
+
- [Usage](#usage)
|
|
26
|
+
- [With HTML (Basic Usage)](#with-html-basic-usage)
|
|
27
|
+
- [With NPM (JS/TS)](#with-npm-jsts)
|
|
28
|
+
- [With ReactJS + TypeScript](#with-reactjs--typescript)
|
|
29
|
+
- [With SSR Framework](#with-ssr-framework)
|
|
30
|
+
- [Player Preset Variants](#player-preset-variants)
|
|
31
|
+
- [Standard Presets](#standard-presets)
|
|
32
|
+
- [Lite Presets](#lite-presets)
|
|
33
|
+
- [Preset Comparison](#preset-comparison)
|
|
34
|
+
- [Preset Usage](#preset-usage)
|
|
35
|
+
- [API](#api)
|
|
36
|
+
- [Properties](#properties)
|
|
37
|
+
- [Events](#events)
|
|
38
|
+
- [Methods](#methods)
|
|
39
|
+
- [Examples](#examples)
|
|
40
|
+
- [Framework-specific Examples](#framework-specific-examples)
|
|
41
|
+
- [Build Testing](#build-testing)
|
|
42
|
+
- [Local Examples](#local-examples)
|
|
43
|
+
|
|
44
|
+
<br />
|
|
45
|
+
|
|
24
46
|
## Usage
|
|
25
47
|
### With HTML (Basic Usage)
|
|
26
48
|
|
|
@@ -115,6 +137,9 @@ export default function Home() {
|
|
|
115
137
|
</script>
|
|
116
138
|
```
|
|
117
139
|
|
|
140
|
+
[Back to contents](#contents)
|
|
141
|
+
<br />
|
|
142
|
+
|
|
118
143
|
## Player Preset Variants
|
|
119
144
|
|
|
120
145
|
ThorVG Lottie Player provides multiple presets optimized for different use cases. Each preset can be selected based on bundle size and performance requirements.
|
|
@@ -122,19 +147,23 @@ ThorVG Lottie Player provides multiple presets optimized for different use cases
|
|
|
122
147
|
### Standard Presets
|
|
123
148
|
- **SW**: A CPU-based renderer with full Lottie specification support
|
|
124
149
|
- **GL**: A WebGL accelerated renderer with full Lottie specification support
|
|
150
|
+
- **WG**: A WebGPU accelerated renderer with full Lottie specification support
|
|
125
151
|
|
|
126
152
|
### Lite Presets
|
|
127
153
|
- **SW-Lite**: A CPU-based renderer that supports basic Lottie specification (PNG only; Fonts and Expressions are not supported)
|
|
128
154
|
- **GL-Lite**: A WebGL accelerated renderer that supports basic Lottie specification (PNG only; Fonts and Expressions are not supported)
|
|
155
|
+
- **WG-Lite**: A WebGPU accelerated renderer that supports basic Lottie specification (PNG only; Fonts and Expressions are not supported)
|
|
129
156
|
|
|
130
157
|
### Preset Comparison
|
|
131
158
|
|
|
132
159
|
| Preset | Renderer | Features | Bundle Size | Use Case |
|
|
133
160
|
|--------|----------|---------|-------------|----------|
|
|
134
|
-
| `sw` | Software | lottie + expressions, jpg, png, webp, ttf | ~
|
|
135
|
-
| `gl` | WebGL | lottie + expressions, jpg, png, webp, ttf | ~
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
161
|
+
| `sw` | Software | lottie + expressions, jpg, png, webp, ttf | ~600KB | Full-featured applications with CPU rendering |
|
|
162
|
+
| `gl` | WebGL | lottie + expressions, jpg, png, webp, ttf | ~650KB | Full-featured applications with WebGL acceleration |
|
|
163
|
+
| `wg` | WebGPU | lottie + expressions, jpg, png, webp, ttf | ~650KB | Full-featured applications with WebGPU acceleration |
|
|
164
|
+
| `sw-lite` | Software | lottie, png | ~250KB | Lightweight applications with CPU rendering |
|
|
165
|
+
| `gl-lite` | WebGL | lottie, png | ~250KB | Lightweight applications with WebGL acceleration |
|
|
166
|
+
| `wg-lite` | WebGPU | lottie, png | ~300KB | Lightweight applications with WebGPU acceleration |
|
|
138
167
|
|
|
139
168
|
### Preset Usage
|
|
140
169
|
|
|
@@ -149,11 +178,17 @@ ThorVG Lottie Player provides multiple presets optimized for different use cases
|
|
|
149
178
|
<!-- WebGL Renderer (Standard) -->
|
|
150
179
|
<script src="https://unpkg.com/@thorvg/lottie-player@latest/dist/gl/lottie-player.js"></script>
|
|
151
180
|
|
|
181
|
+
<!-- WebGPU Renderer (Standard) -->
|
|
182
|
+
<script src="https://unpkg.com/@thorvg/lottie-player@latest/dist/wg/lottie-player.js"></script>
|
|
183
|
+
|
|
152
184
|
<!-- Software Renderer (Lite) -->
|
|
153
185
|
<script src="https://unpkg.com/@thorvg/lottie-player@latest/dist/sw-lite/lottie-player.js"></script>
|
|
154
186
|
|
|
155
187
|
<!-- WebGL Renderer (Lite) -->
|
|
156
188
|
<script src="https://unpkg.com/@thorvg/lottie-player@latest/dist/gl-lite/lottie-player.js"></script>
|
|
189
|
+
|
|
190
|
+
<!-- WebGPU Renderer (Lite) -->
|
|
191
|
+
<script src="https://unpkg.com/@thorvg/lottie-player@latest/dist/wg-lite/lottie-player.js"></script>
|
|
157
192
|
```
|
|
158
193
|
|
|
159
194
|
#### NPM Usage
|
|
@@ -164,16 +199,25 @@ import '@thorvg/lottie-player';
|
|
|
164
199
|
// Software Renderer (Standard)
|
|
165
200
|
import '@thorvg/lottie-player/sw';
|
|
166
201
|
|
|
167
|
-
// WebGL Renderer (Standard)
|
|
202
|
+
// WebGL Renderer (Standard)
|
|
168
203
|
import '@thorvg/lottie-player/gl';
|
|
169
204
|
|
|
205
|
+
// WebGPU Renderer (Standard)
|
|
206
|
+
import '@thorvg/lottie-player/wg';
|
|
207
|
+
|
|
170
208
|
// Software Renderer (Lite)
|
|
171
209
|
import '@thorvg/lottie-player/sw-lite';
|
|
172
210
|
|
|
173
211
|
// WebGL Renderer (Lite)
|
|
174
212
|
import '@thorvg/lottie-player/gl-lite';
|
|
213
|
+
|
|
214
|
+
// WebGPU Renderer (Lite)
|
|
215
|
+
import '@thorvg/lottie-player/wg-lite';
|
|
175
216
|
```
|
|
176
217
|
|
|
218
|
+
[Back to contents](#contents)
|
|
219
|
+
<br />
|
|
220
|
+
|
|
177
221
|
## API
|
|
178
222
|
### Properties
|
|
179
223
|
|
|
@@ -331,6 +375,19 @@ player.addEventListener('load', () => {
|
|
|
331
375
|
|
|
332
376
|
---
|
|
333
377
|
|
|
378
|
+
**Method** : `setQuality(value: number)`
|
|
379
|
+
|
|
380
|
+
**Purpose** : Set rendering quality for animations
|
|
381
|
+
|
|
382
|
+
**Parameters**
|
|
383
|
+
| Name | Type | Description
|
|
384
|
+
| --- | --- | --- |
|
|
385
|
+
| value | `number` | Quality value (1-100). Higher values are likely to support better quality but may impact performance.
|
|
386
|
+
|
|
387
|
+
**Return Type** : `void`
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
334
391
|
**Method** : `save(target: ExportableType)`
|
|
335
392
|
|
|
336
393
|
**Purpose** : Export current animation to other file type
|
|
@@ -351,16 +408,31 @@ player.addEventListener('load', () => {
|
|
|
351
408
|
|
|
352
409
|
**Return Type** : `LibraryVersion`
|
|
353
410
|
|
|
411
|
+
[Back to contents](#contents)
|
|
412
|
+
<br />
|
|
413
|
+
|
|
354
414
|
## Examples
|
|
355
415
|
|
|
356
416
|
### Framework-specific Examples
|
|
357
417
|
|
|
358
|
-
|
|
418
|
+
Check the usage of each preset in the `example/{framework}` directory:
|
|
359
419
|
|
|
360
|
-
- [
|
|
361
|
-
- [
|
|
362
|
-
- [
|
|
363
|
-
|
|
420
|
+
- [ThorVG React Example](example/react/)
|
|
421
|
+
- [ThorVG Vue Example](example/vue/)
|
|
422
|
+
- [ThorVG Svelte Example](example/svelte/)
|
|
423
|
+
|
|
424
|
+
### Build Testing
|
|
425
|
+
|
|
426
|
+
Test framework compatibility by running builds across different frontend frameworks:
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# From the root directory
|
|
430
|
+
$ npm run test:build
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
This will automatically detect framework projects in the `example/` directory and test their build processes.
|
|
434
|
+
|
|
435
|
+
The build testing script is located in `./build-test/`.
|
|
364
436
|
|
|
365
437
|
### Local Examples
|
|
366
438
|
Check the usage of each preset in the `example/` directory:
|
|
@@ -370,3 +442,6 @@ Check the usage of each preset in the `example/` directory:
|
|
|
370
442
|
- [Software Renderer (Lite)](example/software-lite.html) - Basic Lottie support with CPU rendering
|
|
371
443
|
- [WebGL Renderer (Lite)](example/webgl-lite.html) - Basic Lottie support with WebGL acceleration
|
|
372
444
|
- [WebGPU Renderer](example/webgpu.html) - Full Lottie support with WebGPU acceleration
|
|
445
|
+
|
|
446
|
+
[Back to contents](#contents)
|
|
447
|
+
<br />
|