Commit e7dc87f
authored
feat(BrandLoadingScreen): improve lottie animations (#1235)
In order to verify the improvements, I've modified locally the
size-stats example and used bundle analizer to compare the results.
1. Used an online tool to compress the lottie JSON files for Vivo-new
logo. This improved in 20% the total size of the lotties:
- Before:

- After:

2. I noticed that the main bottleneck was using `lottie-react` to render
the lotties. This lib imports `lottie-web`, and that library is quiet
heavy. [Some people
recommended](airbnb/lottie-web#1184 (comment))
importing `lottie-light` from `lottie-web` and using it as replacement
for the default one.
What I've done is copying a minimized version of
([lottie-react](https://github.com/Gamote/lottie-react/blob/main/src/components/Lottie.ts)
into our repository and adapted it to use `lottie-light` instead of
`lottie-web`. This caused a pretty big improvement (over 50% of the
total size of the lib).
- Before:

- After:

In total, by using the exact same example in size-stats, we can see that
the bundles size has been reduced by over 160kb:
- Before:

- After:

## 🗒️ Note
The size stats comment in this PR only shows the improvements caused by
compressing the vivo lotties. The ones obtained by replacing the lottie
library are not visible because the example page in the size-stats
doesn't use a BrandLoadingScreen component (and the lotties are imported
lazily). Refer to the images I've attached in this description to see
the impact.1 parent 02c91f6 commit e7dc87f
10 files changed
Lines changed: 3539 additions & 3666 deletions
File tree
- .yarn
- cache
- patches
- doc
- src/vivinho-loading-animation
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
0 commit comments