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

Optimisation : Progress Radial : Animation #127

Open
hakaba opened this issue Sep 27, 2024 · 0 comments
Open

Optimisation : Progress Radial : Animation #127

hakaba opened this issue Sep 27, 2024 · 0 comments

Comments

@hakaba
Copy link
Collaborator

hakaba commented Sep 27, 2024

Create an animation in CSS instead of requestAnimationFrame.

We need to use vars to define the limits between colors.

<div class="progress-radial" style="--firstLimit:108deg; --secondLimit:216deg; animation: animateGradient 5s infinite;"> [...]</div>

And :

    @keyframes animateGradient {
            0% {
                background: radial-gradient(circle, white 58%, transparent 58.1%),
                            conic-gradient(rgb(12, 123, 145) 0deg, 
                                           rgb(12, 123, 145) 0deg, 
                                           rgb(61, 93, 126) 0deg, 
                                           rgb(61, 93, 126) 0deg, 
                                           gainsboro 0deg, 
                                           gainsboro 360deg);
            }
            100% {
    background: radial-gradient(circle, white 58%, transparent 58.1%),
                            conic-gradient(rgb(12, 123, 145) 0deg, 
                                           rgb(12, 123, 145) var(--firstLimit), 
                                           rgb(61, 93, 126)  var(--firstLimit), 
                                           rgb(61, 93, 126)  var(--secondLimit), 
                                           gainsboro var(--secondLimit), 
                                           gainsboro 360deg);
            }
        };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant