Instantly share code, notes, and snippets.
Created
October 28, 2023 06:15
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save docsallover/9ed2cf3c05858632ae530cd262ee6ae8 to your computer and use it in GitHub Desktop.
Loading Button Animation CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
button { | |
padding: 20px 50px; | |
font-size: 1.5rem; | |
cursor: pointer; | |
border: 0px; | |
background: transparent; | |
position: relative; | |
margin: 20px; | |
transition: all .25s ease; | |
background: rgba(116, 23, 231, 1); | |
border-radius: 28px; | |
color: #fff; | |
overflow: hidden; | |
} | |
button:active { | |
transform: scale(.85); | |
} | |
button.activeLoading .loading { | |
visibility: visible; | |
opacity: 1; | |
} | |
button .loading { | |
opacity: 0; | |
visibility: hidden; | |
} | |
.btn-7 { | |
border-radius: 0px; | |
} | |
.loading { | |
transition: all .25s ease; | |
} | |
.loading-7 { | |
position: absolute; | |
left: 10px; | |
bottom: 10px; | |
width: calc(100% - 20px); | |
height: calc(100% - 20px); | |
background: rgb(116, 23, 231); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
overflow: hidden; | |
} | |
.loading-7 span { | |
background: #fff; | |
position: absolute; | |
} | |
.loading-7 .span1 { | |
width: 100%; | |
height: 5px; | |
left: 0px; | |
bottom: 0px; | |
transform: translate(-100%); | |
animation: loading7a 2s ease infinite; | |
} | |
.loading-7 .span2 { | |
width: 5px; | |
height: 100%; | |
right: 0px; | |
bottom: 0px; | |
transform: translate(0, 100%); | |
animation: loading7b 2s ease infinite; | |
} | |
.loading-7 .span3 { | |
width: 100%; | |
height: 5px; | |
right: 0px; | |
top: 0px; | |
transform: translate(100%); | |
animation: loading7c 2s ease infinite; | |
} | |
.loading-7 .span4 { | |
width: 5px; | |
height: 100%; | |
left: 0px; | |
top: 0px; | |
transform: translate(0, -100%); | |
animation: loading7d 2s ease infinite; | |
} | |
.loading-6 { | |
position: absolute; | |
left: 0px; | |
bottom: 0px; | |
width: 100%; | |
height: 100%; | |
background: rgb(116, 23, 231); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
overflow: hidden; | |
} | |
.loading-6:after { | |
content: ''; | |
width: 40px; | |
height: 40px; | |
opacity: .5; | |
position: absolute; | |
border-radius: 50%; | |
animation: loading6 1.5s ease infinite; | |
border: 5px solid #fff; | |
} | |
.loading-6:before { | |
content: ''; | |
width: 30px; | |
height: 30px; | |
background: #fff; | |
position: absolute; | |
border-radius: 50%; | |
animation: loading6 1s ease infinite; | |
} | |
.loading-5 { | |
position: absolute; | |
left: 0px; | |
bottom: 0px; | |
width: 0%; | |
height: 100%; | |
background: rgba(116, 23, 231, .8); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
overflow: hidden; | |
animation: loading5 1s ease infinite; | |
} | |
.loading-4 { | |
position: absolute; | |
left: 0px; | |
bottom: 0px; | |
width: 100%; | |
height: 100%; | |
background: rgba(116, 23, 231, 1); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
border-radius: inherit; | |
overflow: hidden; | |
} | |
.loading-4 .span1 { | |
width: 8px; | |
height: 8px; | |
background: #fff; | |
border-radius: 50%; | |
animation: loading4 1s ease infinite; | |
position: absolute; | |
} | |
.loading-4 .span2 { | |
width: 8px; | |
height: 8px; | |
background: #fff; | |
border-radius: 50%; | |
animation: loading4 1s ease infinite .33s; | |
position: absolute; | |
} | |
.loading-4 .span3 { | |
width: 8px; | |
height: 8px; | |
background: #fff; | |
border-radius: 50%; | |
animation: loading4 1s ease infinite .66s; | |
position: absolute; | |
} | |
.loading-3 { | |
position: absolute; | |
left: 0px; | |
bottom: 0px; | |
width: 100%; | |
height: 100%; | |
background: rgba(116, 23, 231, .8); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
border-radius: inherit; | |
overflow: hidden; | |
} | |
.loading-3:after { | |
content: ''; | |
position: absolute; | |
width: 100%; | |
height: 4px; | |
bottom: 0px; | |
animation: loading3 1s ease infinite; | |
z-index: 10; | |
background: rgba(255, 255, 255, 1); | |
border-radius: 10px; | |
} | |
.loading-2 { | |
position: absolute; | |
left: 0px; | |
top: 0px; | |
width: 100%; | |
height: 100%; | |
background: rgba(116, 23, 231, .8); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
border-radius: inherit; | |
overflow: hidden; | |
} | |
.loading-2:after { | |
content: ''; | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
animation: loading2 1s ease infinite; | |
z-index: 10; | |
background: rgba(255, 255, 255, .25); | |
} | |
.loading-2:before { | |
content: ''; | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
animation: loading2 1s ease-out infinite; | |
z-index: 10; | |
background: rgba(255, 255, 255, .25); | |
} | |
.loading-1 { | |
position: absolute; | |
left: 0px; | |
top: 0px; | |
width: 100%; | |
height: 100%; | |
background: inherit; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
border-radius: inherit; | |
} | |
.loading-1:after { | |
content: ''; | |
position: absolute; | |
border-radius: 50%; | |
border: 3px solid #fff; | |
width: 30px; | |
height: 30px; | |
border-left: 3px solid transparent; | |
border-bottom: 3px solid transparent; | |
animation: loading1 1s ease infinite; | |
z-index: 10; | |
} | |
.loading-1:before { | |
z-index: 5; | |
content: ''; | |
position: absolute; | |
border-radius: 50%; | |
border: 3px dashed #fff; | |
width: 30px; | |
height: 30px; | |
border-left: 3px solid transparent; | |
border-bottom: 3px solid transparent; | |
animation: loading1 1s linear infinite; | |
} | |
@keyframes loading7d { | |
0% { | |
transform: translate(0, -100%); | |
} | |
25% { | |
transform: translate(0, -100%); | |
} | |
50% { | |
transform: translate(0, -100%); | |
} | |
75% { | |
transform: translate(0, -100%); | |
} | |
100% { | |
transform: translate(0, 100%); | |
} | |
} | |
@keyframes loading7c { | |
0% { | |
transform: translate(100%); | |
} | |
25% { | |
transform: translate(100%); | |
} | |
50% { | |
transform: translate(100%); | |
} | |
75% { | |
transform: translate(-100%); | |
} | |
100% { | |
transform: translate(-100%); | |
} | |
} | |
@keyframes loading7b { | |
0% { | |
transform: translate(0, 100%); | |
} | |
25% { | |
transform: translate(0, 100%); | |
} | |
50% { | |
transform: translate(0, -100%); | |
} | |
100% { | |
transform: translate(0, -100%); | |
} | |
} | |
@keyframes loading7a { | |
0% { | |
transform: translate(-100%); | |
} | |
25% { | |
transform: translate(100%); | |
} | |
100% { | |
transform: translate(100%); | |
} | |
} | |
@keyframes loading6 { | |
0% { | |
transform: scale(0); | |
} | |
50% { | |
transform: scale(1); | |
} | |
100% { | |
transform: scale(0); | |
} | |
} | |
@keyframes loading5 { | |
0% { | |
width: 0px; | |
left: 0px; | |
right: auto; | |
} | |
50% { | |
width: 100%; | |
left: 0px; | |
right: auto; | |
} | |
51% { | |
width: 100%; | |
left: auto; | |
right: 0px; | |
} | |
100% { | |
width: 0%; | |
left: auto; | |
right: 0px; | |
} | |
} | |
@keyframes loading4 { | |
0% { | |
transform: translate(-40px) scale(0); | |
} | |
50% { | |
transform: translate(0px) scale(1); | |
} | |
100% { | |
transform: translate(40px) scale(0); | |
} | |
} | |
@keyframes loading3 { | |
0% { | |
width: 0%; | |
} | |
50% { | |
width: 100%; | |
} | |
100% { | |
width: 100%; | |
opacity: 0; | |
} | |
} | |
@keyframes loading2 { | |
0% { | |
transform: translate(0, 100%); | |
} | |
100% { | |
transform: translate(0, -100%); | |
} | |
} | |
@keyframes loading1 { | |
0% { | |
transform: rotate(0deg); | |
} | |
100% { | |
transform: rotate(360deg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment