DotLottie worker
Overview
Some Lottie animations might be resource-intensive to render based on the Lottie features utilized and the size. While this is generally acceptable, performance can become an issue when there are multiple animations running simultaneously. Offloading the rendering to a worker thread can help improve performance
This enhancement involves developing a DotLottieWorker class, which will utilize the core dotlottie-rs WebAssembly (WASM) bindings within a Worker thread. This feature should not introduce any breaking changes to the current DotLottie setup and usage, and it will be an opt-in feature
Motivation
What inspired this enhancement? What makes you think this should be included?
The main motivation for this enhancement is to improve the performance of the DotLottie web library when handling multiple animations. By offloading rendering tasks to individual worker threads, we can ensure smoother animations and better overall performance, especially in scenarios where multiple animations are present
Labels
- [x] Add the
Type: Enhancementlabel to this issue.
@theashraf jyfi, thorvg nested threads will improve the performance as well. probably dotlottie could consider applying either one which is better for perf & size.
Hi @theashraf - I'm very interested in this enhancement! is there an ETA for targeted release (weeks/months)?
Hi @danrydholm,Thank you for your interest. we expect to support this by next month. In the meantime, if you would like to offload DotLottie to a worker, there is a CodePen example demonstrating how this can be done: CodePen example
Added in @lottiefiles/[email protected] release
Now that this feature is completed, is there any reason not to always use it with web worker? What should be the default?