Skip to content

Instantly share code, notes, and snippets.

@hoangsetup
Created May 31, 2023 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoangsetup/2f0d40c713c521681622ba035dca2705 to your computer and use it in GitHub Desktop.
Save hoangsetup/2f0d40c713c521681622ba035dca2705 to your computer and use it in GitHub Desktop.
Loading animation
<div class="wrapper">
<div class="bg">
<div class="load"></div>
</div>
</div>
<div class ="text"> Loading... </div>
@import url(https://fonts.googleapis.com/css?family=Bungee);
$loadingTime: 20s;
$color: rgb(255,192,203);
body {
background-color: white;
}
@keyframes loading {
0% {
width: 0;
} 100% {
width: 100%;
}
}
@keyframes percentage {
@for $i from 1 through 100 {
$percentage: $i + "%";
#{$percentage} {
content: $percentage;
}
}
}
.bg {
background-color: $color;
animation: loading $loadingTime linear infinite;
}
.load{
color: $color;
width: 200px;
border: 1px solid $color;
&:after {
padding-left: 20px;
content: "0%";
display: block;
text-align: center;
font-size: 12px;
padding: 10px 20px;
color: rgb(0,255,255);
mix-blend-mode: difference;
animation: percentage $loadingTime linear infinite;
}
}
html {
height: 100%;
background-color: white;
font-family: 'Bungee', sans-serif;
font-weight: bold;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.text{
margin-left: -190px;
margin-bottom: 100px;
font-family:'Bungee';
color: rgb(255,182,193);
font-size: 1.7rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment