Skip to content

fix(react-skeleton): update wave animation#32077

Merged
dmytrokirpa merged 3 commits intomicrosoft:masterfrom
dmytrokirpa:fix_skeleton_animation
Aug 5, 2024
Merged

fix(react-skeleton): update wave animation#32077
dmytrokirpa merged 3 commits intomicrosoft:masterfrom
dmytrokirpa:fix_skeleton_animation

Conversation

@dmytrokirpa
Copy link
Contributor

@dmytrokirpa dmytrokirpa commented Jul 23, 2024

Previous Behavior

Under CPU load, the spinning animation produces jank and frames are dropped because the animation relies on the main thread to update.

This can be observed by the fact that the animation is painting every frame. In Edge DevTools, press Ctrl+Shift+P to show green rectangles on paint.
before

New Behavior

The main idea is to utilize transform: translateX instead of the backgroundPositionX for "wave" animations. This approach delegates the animation to the compositor thread, enhancing performance regardless of the CPU load.

Related Issue(s)

@fabricteam
Copy link
Collaborator

fabricteam commented Jul 23, 2024

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.095 MB
270.359 kB
1.095 MB
270.408 kB
222 B
49 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.141 kB
20.157 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
217.412 kB
63.063 kB
react-components
react-components: FluentProvider & webLightTheme
44.442 kB
14.607 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-timepicker-compat
TimePicker
106.751 kB
35.596 kB
🤖 This report was generated against b6b53b9f4b56968cdf6e127692b5abfd807e0f46

@fabricteam
Copy link
Collaborator

fabricteam commented Jul 23, 2024

Perf Analysis (@fluentui/react-components)

Scenario Render type Master Ticks PR Ticks Iterations Status
FluentProviderWithTheme virtual-rerender 40 30 10 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 648 617 5000
Button mount 304 332 5000
Field mount 1168 1108 5000
FluentProvider mount 704 720 5000
FluentProviderWithTheme mount 87 88 10
FluentProviderWithTheme virtual-rerender 40 30 10 Possible regression
FluentProviderWithTheme virtual-rerender-with-unmount 78 83 10
MakeStyles mount 895 987 50000
Persona mount 1816 1719 5000
SpinButton mount 1408 1506 5000
SwatchPicker mount 1659 1648 5000

@dmytrokirpa dmytrokirpa marked this pull request as ready for review July 24, 2024 08:49
@dmytrokirpa dmytrokirpa requested a review from a team as a code owner July 24, 2024 08:49
@dmytrokirpa dmytrokirpa requested a review from a team July 24, 2024 12:05
@tudorpopams tudorpopams requested a review from marcosmoura July 25, 2024 12:05
@spmonahan
Copy link
Contributor

This animations look different after this change.

Before

Screen recording of the animation before this change

After

Screen recording of the animation after this change

I haven't looked at the design spec but the after does seem more correct based on the animation names. If this is intended please update the change file and PR description to include this change.

@dmytrokirpa dmytrokirpa changed the title fix(react-skeleton): update animation be offloadable to the compositor thread fix(react-skeleton): update wave animation Aug 5, 2024
@dmytrokirpa dmytrokirpa force-pushed the fix_skeleton_animation branch from bee7017 to c68ef6c Compare August 5, 2024 15:17
@dmytrokirpa
Copy link
Contributor Author

@spmonahan The design specification does not provide specific values for the wave animation; it simply states that the gradient is animated from left to right, which appears to be consistent with this PR. Therefore, I think we are ready to proceed with this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Skeleton uses main thread for animation, causes jank under CPU load

7 participants