ni / nimble

The NI Nimble Design System
https://nimble.ni.dev
MIT License
32 stars 8 forks source link

Landing page animation runs slow on mobile #908

Closed rajsite closed 1 year ago

rajsite commented 1 year ago

πŸ› Bug Report

The current nimble.ni.dev landing page animation runs very slow on mobile devices (Android pixel 3a).

Found that it is due to animating the stroke-dasharray property: https://github.com/ni/nimble/blob/6d1ae5605adda84ad46fd47c1dbeb500f6ca9a6e/packages/site/landing/styles.scss#L43

In order to have the best performance across a wide set of devices we should only animate the transform and opacity properties, see web.dev's article Why are some animations slow?

πŸ’» Repro or Code Sample

Visit the landing page on a low power device. Carson also noticed low perf of the landing page on a macbook running firefox which I bet is related.

πŸ€” Expected Behavior

Beautiful 60fps rendering across platforms.

😯 Current Behavior

Runs at a low framerate on Android and makes the whole experience choppy (scrolling etc)

πŸ’ Possible Solution

Tested locally that only animating the transform was performant on Android. Did not test that addresses the Firefox case. Likely need stylistic tweaks to the animation if only animating transform so didn't make a PR.

πŸ”¦ Context

Checking out the awesome site on my phone.

🌍 Your Environment

Android Pixel 3a Chrome 108

rajsite commented 1 year ago

Fixed by https://github.com/ni/nimble/commit/3e166e8fb81ba240bbc869c6b18208503e0efddb