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

CSS animations are sometimes not smooth & performant. #28

Open
sypherphoenix opened this issue Sep 12, 2024 · 2 comments
Open

CSS animations are sometimes not smooth & performant. #28

sypherphoenix opened this issue Sep 12, 2024 · 2 comments
Labels
performance Issues related to rendering performance and optimization.

Comments

@sypherphoenix
Copy link
Owner

sypherphoenix commented Sep 12, 2024

I originally thought this issue might be related to Firefox, but it seems like it's mostly related to hardware acceleration. With hardware acceleration turned off, some pages will have very choppy animations or scrolling.

We aren't making a complicated site, so we don't want to need hardware acceleration in order to have a good experience.

Right now the issues are caused by the background styling sections in style.css. I think it's mostly related to the alpha blending employed.

body {
/* Color definitions */
--color_theme_faint: hsl(0, 0%, 70%);
--color_theme_dark: hsl(0, 0%, 14%);
--color_theme_black: hsl(0, 0%, 4%);
color: white;
margin: 0px;
font-family: 'FolkPro', sans-serif;
overscroll-behavior: none;
background-size: 200% 200%;
background-image: repeating-linear-gradient(67.5deg, var(--color_theme_dark), var(--color_theme_black) 400px, var(--color_theme_black) 800px, var(--color_theme_dark) 1200px);
animation: pan linear 15s infinite;
}
@keyframes pan {
100% {
background-position: 100%;
}
}
.bg_stripes {
background: repeating-linear-gradient(-22.5deg,
var(--color_theme_black),
var(--color_theme_black) 5px,
rgba(0, 0, 0, 0) 5px,
rgba(0, 0, 0, 0) 10px);
}
.bg_grid {
padding-top: 10%;
padding-bottom: 40%;
background-size: 40px 40px;
background-image:
linear-gradient(to right, rgba(128, 128, 128, 0.25) 2px, transparent 2px),
linear-gradient(to bottom, rgba(128, 128, 128, 0.25) 2px, transparent 2px);
}

Alternatives need to be investigated such as using different tiling sizes, avoiding alpha, or using static images.

@sypherphoenix sypherphoenix added the performance Issues related to rendering performance and optimization. label Sep 12, 2024
@sypherphoenix
Copy link
Owner Author

Removing the animation improves performance considerably but isn't the only cause. Maybe the method used to animate is also unnecessarily strenuous? (either by timing or by what is keyframed)

@sypherphoenix
Copy link
Owner Author

sypherphoenix commented Sep 12, 2024

The diagonal line effect we're using is inspired by this page: https://codepen.io/Hyperplexed/pen/zYXZoZg

(see scrolling stripes on the bottom sides)

Maybe it can inform us about good practices (I'm not going to look at this now lol)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Issues related to rendering performance and optimization.
Projects
None yet
Development

No branches or pull requests

1 participant