Skip to content
Advertisement

CSS Shimmer effect with blocking JavaScript

I have a shimmer React component with the following CSS

JavaScript

and the animation keyframe I apply to it is as follows:

JavaScript

My home page is quite heavy on mount. So the animation freezes for about a second or so. I read that animating transition is done off-thread https://www.phpied.com/css-animations-off-the-ui-thread/

Can anyone help me do my shimmer effect in a similar off-thread manner?

Advertisement

Answer

Use transform as suggested in the link. Here is an idea with pseudo element:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement