Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(web): set default DPR to 75% of machine's DPR #329

Closed
theashraf opened this issue Aug 20, 2024 · 1 comment · Fixed by #332
Closed

perf(web): set default DPR to 75% of machine's DPR #329

theashraf opened this issue Aug 20, 2024 · 1 comment · Fixed by #332
Assignees
Labels
enhancement New feature or request web

Comments

@theashraf
Copy link
Member

theashraf commented Aug 20, 2024

Currently, the dotlottie-web package allows users to control the devicePixelRatio (DPR) through the renderConfig option. By default, it uses the machine's full DPR, which can lead to unnecessary resource usage without any noticeable improvement in animation quality, especially on high-DPI screens.

To provide better default rendering performance out-of-the-box, it is recommended to set the default DPR to 75% of the machine's DPR. This change will offer a balanced trade-off between rendering quality and performance, ensuring smoother animations.

Proposed Changes:

Adjust the default devicePixelRatio in RenderConfig to window.devicePixelRatio * 0.75 or 0.75, whichever is lower.

cc @hermet

@theashraf theashraf added enhancement New feature or request web labels Aug 20, 2024
@theashraf theashraf self-assigned this Aug 20, 2024
@theashraf theashraf changed the title perf: set default DPR to 70% of machine's DPR perf(web): set default DPR to 70% of machine's DPR Aug 20, 2024
@hermet
Copy link
Member

hermet commented Aug 20, 2024

Adjust the default devicePixelRatio in RenderConfig to window.devicePixelRatio * 0.7 or 0.7, whichever is lower.

@theashraf Leaving this, Just in case. The result will be 0.7 when the DPR is 1. The main idea is to adjust the resolution when the DPR is higher (for more effective on smaller LED diodes).

Please check where the ThorVG player’s default DPR is set for guaranting dpr is 1 or higher than it.

dpr = 1 + ((window.devicePixelRatio - 1) * 0.75x;   //assume window dpr is 1 or higher than it.

@theashraf theashraf changed the title perf(web): set default DPR to 70% of machine's DPR perf(web): set default DPR to 75% of machine's DPR Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web
Projects
None yet
2 participants