It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 21 May 2020
Downloads always took some time! So make the buttons more interesting by showing the animating progress indicator to them. Below are two examples of such buttons. Enjoy!
<!-- this script is provided by https://www.htmlbestcodes.com coded by: Kerixa Inc. -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Poppins:300,400,500,700&display=swap'>
<style>
@-webkit-keyframes status-animation {
1% {
content: "1%";
}
2% {
content: "2%";
}
3% {
content: "3%";
}
4% {
content: "4%";
}
5% {
content: "5%";
}
6% {
content: "6%";
}
7% {
content: "7%";
}
8% {
content: "8%";
}
9% {
content: "9%";
}
10% {
content: "10%";
}
11% {
content: "11%";
}
12% {
content: "12%";
}
13% {
content: "13%";
}
14% {
content: "14%";
}
15% {
content: "15%";
}
16% {
content: "16%";
}
17% {
content: "17%";
}
18% {
content: "18%";
}
19% {
content: "19%";
}
20% {
content: "20%";
}
21% {
content: "21%";
}
22% {
content: "22%";
}
23% {
content: "23%";
}
24% {
content: "24%";
}
25% {
content: "25%";
}
26% {
content: "26%";
}
27% {
content: "27%";
}
28% {
content: "28%";
}
29% {
content: "29%";
}
30% {
content: "30%";
}
31% {
content: "31%";
}
32% {
content: "32%";
}
33% {
content: "33%";
}
34% {
content: "34%";
}
35% {
content: "35%";
}
36% {
content: "36%";
}
37% {
content: "37%";
}
38% {
content: "38%";
}
39% {
content: "39%";
}
40% {
content: "40%";
}
41% {
content: "41%";
}
42% {
content: "42%";
}
43% {
content: "43%";
}
44% {
content: "44%";
}
45% {
content: "45%";
}
46% {
content: "46%";
}
47% {
content: "47%";
}
48% {
content: "48%";
}
49% {
content: "49%";
}
50% {
content: "50%";
}
51% {
content: "51%";
}
52% {
content: "52%";
}
53% {
content: "53%";
}
54% {
content: "54%";
}
55% {
content: "55%";
}
56% {
content: "56%";
}
57% {
content: "57%";
}
58% {
content: "58%";
}
59% {
content: "59%";
}
60% {
content: "60%";
}
61% {
content: "61%";
}
62% {
content: "62%";
}
63% {
content: "63%";
}
64% {
content: "64%";
}
65% {
content: "65%";
}
66% {
content: "66%";
}
67% {
content: "67%";
}
68% {
content: "68%";
}
69% {
content: "69%";
}
70% {
content: "70%";
}
71% {
content: "71%";
}
72% {
content: "72%";
}
73% {
content: "73%";
}
74% {
content: "74%";
}
75% {
content: "75%";
}
76% {
content: "76%";
}
77% {
content: "77%";
}
78% {
content: "78%";
}
79% {
content: "79%";
}
80% {
content: "80%";
}
81% {
content: "81%";
}
82% {
content: "82%";
}
83% {
content: "83%";
}
84% {
content: "84%";
}
85% {
content: "85%";
}
86% {
content: "86%";
}
87% {
content: "87%";
}
88% {
content: "88%";
}
89% {
content: "89%";
}
90% {
content: "90%";
}
91% {
content: "91%";
}
92% {
content: "92%";
}
93% {
content: "93%";
}
94% {
content: "94%";
}
95% {
content: "95%";
}
96% {
content: "96%";
}
97% {
content: "97%";
}
98% {
content: "98%";
}
99% {
content: "99%";
}
100% {
content: "100%";
}
}
@keyframes status-animation {
1% {
content: "1%";
}
2% {
content: "2%";
}
3% {
content: "3%";
}
4% {
content: "4%";
}
5% {
content: "5%";
}
6% {
content: "6%";
}
7% {
content: "7%";
}
8% {
content: "8%";
}
9% {
content: "9%";
}
10% {
content: "10%";
}
11% {
content: "11%";
}
12% {
content: "12%";
}
13% {
content: "13%";
}
14% {
content: "14%";
}
15% {
content: "15%";
}
16% {
content: "16%";
}
17% {
content: "17%";
}
18% {
content: "18%";
}
19% {
content: "19%";
}
20% {
content: "20%";
}
21% {
content: "21%";
}
22% {
content: "22%";
}
23% {
content: "23%";
}
24% {
content: "24%";
}
25% {
content: "25%";
}
26% {
content: "26%";
}
27% {
content: "27%";
}
28% {
content: "28%";
}
29% {
content: "29%";
}
30% {
content: "30%";
}
31% {
content: "31%";
}
32% {
content: "32%";
}
33% {
content: "33%";
}
34% {
content: "34%";
}
35% {
content: "35%";
}
36% {
content: "36%";
}
37% {
content: "37%";
}
38% {
content: "38%";
}
39% {
content: "39%";
}
40% {
content: "40%";
}
41% {
content: "41%";
}
42% {
content: "42%";
}
43% {
content: "43%";
}
44% {
content: "44%";
}
45% {
content: "45%";
}
46% {
content: "46%";
}
47% {
content: "47%";
}
48% {
content: "48%";
}
49% {
content: "49%";
}
50% {
content: "50%";
}
51% {
content: "51%";
}
52% {
content: "52%";
}
53% {
content: "53%";
}
54% {
content: "54%";
}
55% {
content: "55%";
}
56% {
content: "56%";
}
57% {
content: "57%";
}
58% {
content: "58%";
}
59% {
content: "59%";
}
60% {
content: "60%";
}
61% {
content: "61%";
}
62% {
content: "62%";
}
63% {
content: "63%";
}
64% {
content: "64%";
}
65% {
content: "65%";
}
66% {
content: "66%";
}
67% {
content: "67%";
}
68% {
content: "68%";
}
69% {
content: "69%";
}
70% {
content: "70%";
}
71% {
content: "71%";
}
72% {
content: "72%";
}
73% {
content: "73%";
}
74% {
content: "74%";
}
75% {
content: "75%";
}
76% {
content: "76%";
}
77% {
content: "77%";
}
78% {
content: "78%";
}
79% {
content: "79%";
}
80% {
content: "80%";
}
81% {
content: "81%";
}
82% {
content: "82%";
}
83% {
content: "83%";
}
84% {
content: "84%";
}
85% {
content: "85%";
}
86% {
content: "86%";
}
87% {
content: "87%";
}
88% {
content: "88%";
}
89% {
content: "89%";
}
90% {
content: "90%";
}
91% {
content: "91%";
}
92% {
content: "92%";
}
93% {
content: "93%";
}
94% {
content: "94%";
}
95% {
content: "95%";
}
96% {
content: "96%";
}
97% {
content: "97%";
}
98% {
content: "98%";
}
99% {
content: "99%";
}
100% {
content: "100%";
}
}
.dl {
--background: #FFFFFF;
--primary: #1F242D;
--border-radius: 3px;
--square-size: 70px;
--progress-color: linear-gradient(to right top, #00A7FC, #0070ED);
display: -webkit-box;
display: flex;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
}
.dl .dl-box {
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: var(--border-radius);
overflow: hidden;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.dl .dl-box .dl-button {
width: 55px;
height: 55px;
position: relative;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
background: var(--primary);
cursor: pointer;
-webkit-transition: width .2s ease-in .4s, height .2s ease-in .4s, background .2s ease-in .4s;
transition: width .2s ease-in .4s, height .2s ease-in .4s, background .2s ease-in .4s;
}
.dl .dl-box .dl-button .arrow {
position: absolute;
top: 20px;
width: 2px;
height: 15px;
background: var(--background);
border-radius: var(--border-radius);
-webkit-transition: background .2s ease-in .4s;
transition: background .2s ease-in .4s;
}
.dl .dl-box .dl-button .arrow:before, .dl .dl-box .dl-button .arrow:after {
content: "";
display: block;
width: 2px;
height: 8px;
background: var(--background);
position: absolute;
bottom: 0px;
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
border-radius: var(--border-radius);
-webkit-transition: background .2s ease-in .4s;
transition: background .2s ease-in .4s;
}
.dl .dl-box .dl-button .arrow:before {
-webkit-transform: rotate(-45deg) translateX(25%);
transform: rotate(-45deg) translateX(25%);
}
.dl .dl-box .dl-button .arrow:after {
-webkit-transform: rotate(45deg) translateX(-25%);
transform: rotate(45deg) translateX(-25%);
}
.dl .dl-box .dl-button .basket {
position: absolute;
width: 40px;
height: 20px;
bottom: 20px;
border-radius: var(--border-radius);
}
.dl .dl-box .dl-button .basket:before, .dl .dl-box .dl-button .basket:after {
content: "";
position: absolute;
bottom: 0;
height: 0;
width: 0;
display: block;
opacity: var(--opacity, 0);
-webkit-transition: opacity .15s linear;
transition: opacity .15s linear;
border-bottom: solid 2px var(--primary);
box-sizing: border-box;
}
.dl .dl-box .dl-button .basket:before {
left: calc(40px / 2);
border-right: solid 2px var(--primary);
border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
.dl .dl-box .dl-button .basket:after {
right: calc(40px / 2);
border-left: solid 2px var(--primary);
border-radius: var(--border-radius) 0 0 var(--border-radius);
}
.dl .dl-box .dl-button .basket .basket-top:before, .dl .dl-box .dl-button .basket .basket-top:after {
content: "";
position: absolute;
top: 0;
height: 0;
width: 0;
display: block;
border-top: solid 2px var(--primary);
}
.dl .dl-box .dl-button .basket .basket-top:before {
left: 2px;
border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
.dl .dl-box .dl-button .basket .basket-top:after {
right: 2px;
border-radius: var(--border-radius) 0 0 var(--border-radius);
}
.dl .dl-box .dl-progress {
width: 0px;
height: 100%;
position: relative;
-webkit-transition: width .2s ease-in, height 0s linear .2s;
transition: width .2s ease-in, height 0s linear .2s;
}
.dl .dl-box .dl-progress::after {
content: "";
position: absolute;
top: 100%;
bottom: 0;
left: 0;
width: 100%;
background: var(--progress-color);
-webkit-transition: top 0s ease .4s;
transition: top 0s ease .4s;
}
.dl .dl-box .dl-progress .check {
position: relative;
z-index: 1;
pointer-events: none;
width: 100%;
height: 100%;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
}
.dl .dl-box .dl-progress .check svg {
height: 45px;
width: 45px;
fill: none;
stroke: var(--background);
stroke-width: 6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 100 100;
stroke-dashoffset: 100;
}
.dl .dl-status {
margin-left: 0;
flex-basis: 0;
width: 0;
-webkit-transition: all .2s ease-out .2s;
transition: all .2s ease-out .2s;
-webkit-clip-path: inset(0 var(--square-size) 0 0);
clip-path: inset(0 var(--square-size) 0 0);
}
.dl .dl-status .text {
text-align: left;
text-transform: uppercase;
color: rgba(0, 0, 0, 0.3);
font-weight: 500;
letter-spacing: .5px;
line-height: 23px;
}
.dl .dl-status .text.text-number {
font-weight: 600;
color: rgba(0, 0, 0, 0.6);
}
.dl .dl-status .text.text-number::after {
content: "0%";
}
.dl.run .dl-box {
height: 100%;
}
.dl.run .dl-box .dl-button {
width: var(--square-size);
height: var(--square-size);
background: var(--background);
-webkit-transition: width .2s ease-out .3s, height .2s ease-out .3s, background .2s ease-out .3s;
transition: width .2s ease-out .3s, height .2s ease-out .3s, background .2s ease-out .3s;
}
.dl.run .dl-box .dl-button .arrow {
background: var(--primary);
-webkit-transition: background .3s ease-in;
transition: background .3s ease-in;
-webkit-animation: arrow-main .75s ease-in forwards infinite;
animation: arrow-main .75s ease-in forwards infinite;
}
.dl.run .dl-box .dl-button .arrow:before, .dl.run .dl-box .dl-button .arrow:after {
-webkit-transition: background .3s ease-in;
transition: background .3s ease-in;
background: var(--primary);
}
.dl.run .dl-box .dl-button .arrow:before {
-webkit-animation: arrow-left .75s ease-in forwards infinite;
animation: arrow-left .75s ease-in forwards infinite;
}
.dl.run .dl-box .dl-button .arrow:after {
-webkit-animation: arrow-right .75s ease-in forwards infinite;
animation: arrow-right .75s ease-in forwards infinite;
}
.dl.run .dl-box .dl-button .basket:before, .dl.run .dl-box .dl-button .basket:after {
--opacity: 1;
-webkit-transition: opacity 0s linear .3s;
transition: opacity 0s linear .3s;
-webkit-animation: btn-border .3s forwards ease-in normal .5s;
animation: btn-border .3s forwards ease-in normal .5s;
}
.dl.run .dl-box .dl-button .basket .basket-top:before, .dl.run .dl-box .dl-button .basket .basket-top:after {
-webkit-animation: btn-border-top .3s forwards ease-in normal .8s;
animation: btn-border-top .3s forwards ease-in normal .8s;
}
.dl.run .dl-box .dl-progress {
width: var(--square-size);
height: var(--square-size);
-webkit-transition: width .3s ease-in .7s, height .3s ease-in .7s;
transition: width .3s ease-in .7s, height .3s ease-in .7s;
background: var(--background);
}
.dl.run .dl-box .dl-progress::after {
top: 0px;
-webkit-transition: top 2.5s ease 1.5s;
transition: top 2.5s ease 1.5s;
}
.dl.run .dl-status {
width: var(--square-size);
-webkit-clip-path: inset(0 0 0 0);
clip-path: inset(0 0 0 0);
-webkit-transition: all .3s ease-in .7s;
transition: all .3s ease-in .7s;
}
.dl.run .dl-status .text.text-number::after {
-webkit-animation: status-animation 2.5s ease 1.5s forwards;
animation: status-animation 2.5s ease 1.5s forwards;
}
.dl.done .dl-box .dl-button .arrow {
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.dl.done .dl-box .dl-button .arrow:before {
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.dl.done .dl-box .dl-button .arrow:after {
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.dl.done .dl-box .dl-progress .check svg {
-webkit-animation: check .3s ease-in-out forwards;
animation: check .3s ease-in-out forwards;
}
@-webkit-keyframes arrow-main {
0% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
30% {
-webkit-transform: translateY(-5px);
transform: translateY(-5px);
}
80% {
-webkit-transform: translateY(5px);
transform: translateY(5px);
}
100% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
}
@keyframes arrow-main {
0% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
30% {
-webkit-transform: translateY(-5px);
transform: translateY(-5px);
}
80% {
-webkit-transform: translateY(5px);
transform: translateY(5px);
}
100% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
}
@-webkit-keyframes arrow-left {
0% {
-webkit-transform: rotate(-45deg) translateX(25%);
transform: rotate(-45deg) translateX(25%);
}
30% {
-webkit-transform: rotate(-55deg) translateX(25%);
transform: rotate(-55deg) translateX(25%);
}
80% {
-webkit-transform: rotate(-35deg) translateX(25%);
transform: rotate(-35deg) translateX(25%);
}
100% {
-webkit-transform: rotate(-45deg) translateX(25%);
transform: rotate(-45deg) translateX(25%);
}
}
@keyframes arrow-left {
0% {
-webkit-transform: rotate(-45deg) translateX(25%);
transform: rotate(-45deg) translateX(25%);
}
30% {
-webkit-transform: rotate(-55deg) translateX(25%);
transform: rotate(-55deg) translateX(25%);
}
80% {
-webkit-transform: rotate(-35deg) translateX(25%);
transform: rotate(-35deg) translateX(25%);
}
100% {
-webkit-transform: rotate(-45deg) translateX(25%);
transform: rotate(-45deg) translateX(25%);
}
}
@-webkit-keyframes arrow-right {
0% {
-webkit-transform: rotate(45deg) translateX(-25%);
transform: rotate(45deg) translateX(-25%);
}
30% {
-webkit-transform: rotate(55deg) translateX(-25%);
transform: rotate(55deg) translateX(-25%);
}
80% {
-webkit-transform: rotate(35deg) translateX(-25%);
transform: rotate(35deg) translateX(-25%);
}
100% {
-webkit-transform: rotate(45deg) translateX(-25%);
transform: rotate(45deg) translateX(-25%);
}
}
@keyframes arrow-right {
0% {
-webkit-transform: rotate(45deg) translateX(-25%);
transform: rotate(45deg) translateX(-25%);
}
30% {
-webkit-transform: rotate(55deg) translateX(-25%);
transform: rotate(55deg) translateX(-25%);
}
80% {
-webkit-transform: rotate(35deg) translateX(-25%);
transform: rotate(35deg) translateX(-25%);
}
100% {
-webkit-transform: rotate(45deg) translateX(-25%);
transform: rotate(45deg) translateX(-25%);
}
}
@-webkit-keyframes btn-border {
0% {
width: 0;
height: 0;
}
50% {
width: calc(40px / 2);
height: 0;
}
100% {
width: calc(40px / 2);
height: 20px;
}
}
@keyframes btn-border {
0% {
width: 0;
height: 0;
}
50% {
width: calc(40px / 2);
height: 0;
}
100% {
width: calc(40px / 2);
height: 20px;
}
}
@-webkit-keyframes btn-border-top {
0% {
width: 0px;
}
100% {
width: 10px;
}
}
@keyframes btn-border-top {
0% {
width: 0px;
}
100% {
width: 10px;
}
}
@-webkit-keyframes check {
0% {
stroke-dashoffset: 100;
}
100% {
stroke-dashoffset: 200;
}
}
@keyframes check {
0% {
stroke-dashoffset: 100;
}
100% {
stroke-dashoffset: 200;
}
}
body {
background: #E8EBF3;
height: 100vh;
font: 400 16px 'Poppins', sans-serif;
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
}
body .socials {
position: fixed;
display: block;
left: 20px;
bottom: 20px;
}
body .socials > a {
display: block;
width: 30px;
opacity: .2;
-webkit-transform: scale(var(--scale, 0.8));
transform: scale(var(--scale, 0.8));
-webkit-transition: -webkit-transform 0.3s cubic-bezier(0.38, -0.12, 0.24, 1.91);
transition: -webkit-transform 0.3s cubic-bezier(0.38, -0.12, 0.24, 1.91);
transition: transform 0.3s cubic-bezier(0.38, -0.12, 0.24, 1.91);
transition: transform 0.3s cubic-bezier(0.38, -0.12, 0.24, 1.91), -webkit-transform 0.3s cubic-bezier(0.38, -0.12, 0.24, 1.91);
}
body .socials > a:hover {
--scale: 1;
}
.button {
--default: rgba(255, 255, 255, .2);
--active: #fff;
position: relative;
border: none;
outline: none;
background: none;
padding: 0;
-webkit-appearance: none;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
-webkit-transform: scale(var(--s, 1));
transform: scale(var(--s, 1));
-webkit-transition: -webkit-transform .2s;
transition: -webkit-transform .2s;
transition: transform .2s;
transition: transform .2s, -webkit-transform .2s;
}
.button:active {
--s: .96;
}
.button svg {
display: block;
fill: none;
stroke-width: var(--sw, 3px);
stroke-linecap: round;
stroke-linejoin: round;
}
.button .circle {
width: 76px;
height: 76px;
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
}
.button .circle circle.default {
stroke: var(--default);
}
.button .circle circle.active {
stroke: var(--active);
stroke-dasharray: 227px;
stroke-dashoffset: var(--active-offset, 227px);
-webkit-transition: stroke-dashoffset var(--all-transition, 4s) ease var(--all-delay, 0.8s);
transition: stroke-dashoffset var(--all-transition, 4s) ease var(--all-delay, 0.8s);
}
.button span {
display: block;
position: absolute;
left: 0;
right: 0;
text-align: center;
bottom: 13px;
font-weight: 500;
font-size: 10px;
color: var(--active);
opacity: var(--count-opacity, 0);
-webkit-transform: translateY(var(--count-y, 4px));
transform: translateY(var(--count-y, 4px));
-webkit-animation: var(--count, none) 0.3s ease forwards var(--all-delay, 4.6s);
animation: var(--count, none) 0.3s ease forwards var(--all-delay, 4.6s);
-webkit-transition: opacity .2s ease .6s, -webkit-transform .3s ease .6s;
transition: opacity .2s ease .6s, -webkit-transform .3s ease .6s;
transition: opacity .2s ease .6s, transform .3s ease .6s;
transition: opacity .2s ease .6s, transform .3s ease .6s, -webkit-transform .3s ease .6s;
}
.button .icon {
--sw: 2px;
width: 24px;
height: 40px;
position: absolute;
left: 50%;
top: 50%;
margin: -20px 0 0 -12px;
}
.button .icon svg.line {
width: 4px;
height: 37px;
stroke: var(--active);
position: absolute;
left: 10px;
top: 0;
stroke-dasharray: 0 33px var(--line-array, 33px) 66px;
stroke-dashoffset: var(--line-offset, 33px);
-webkit-transform: translateY(var(--line-y, 0));
transform: translateY(var(--line-y, 0));
opacity: var(--line-opacity, 1);
-webkit-transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, -webkit-transform 0.32s ease var(--all-delay, 0.25s);
transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, -webkit-transform 0.32s ease var(--all-delay, 0.25s);
transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, transform 0.32s ease var(--all-delay, 0.25s);
transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, transform 0.32s ease var(--all-delay, 0.25s), -webkit-transform 0.32s ease var(--all-delay, 0.25s);
}
.button .icon div {
width: 40px;
height: 32px;
position: absolute;
overflow: hidden;
left: 50%;
bottom: 1px;
margin-left: -20px;
-webkit-transform: translate(var(--icon-x, 0), var(--icon-y, 0));
transform: translate(var(--icon-x, 0), var(--icon-y, 0));
-webkit-transition: -webkit-transform 0.3s ease var(--all-delay, 4.8s);
transition: -webkit-transform 0.3s ease var(--all-delay, 4.8s);
transition: transform 0.3s ease var(--all-delay, 4.8s);
transition: transform 0.3s ease var(--all-delay, 4.8s), -webkit-transform 0.3s ease var(--all-delay, 4.8s);
-webkit-animation: var(--overflow, none) 0s linear forwards var(--all-delay, 4.8s);
animation: var(--overflow, none) 0s linear forwards var(--all-delay, 4.8s);
}
.button .icon div:before, .button .icon div:after {
content: '';
position: absolute;
z-index: 1;
height: 2px;
left: var(--l, 0);
top: 15px;
width: var(--w, 16px);
background: var(--active);
border-radius: 1px;
-webkit-transform-origin: var(--tx, 15px) 1px;
transform-origin: var(--tx, 15px) 1px;
-webkit-transform: rotate(var(--before-rotate, 0deg));
transform: rotate(var(--before-rotate, 0deg));
opacity: var(--tick-opacity, 0);
-webkit-transition: opacity 0s linear var(--all-delay, 4.8s), -webkit-transform 0.4s ease var(--all-delay, 4.8s);
transition: opacity 0s linear var(--all-delay, 4.8s), -webkit-transform 0.4s ease var(--all-delay, 4.8s);
transition: transform 0.4s ease var(--all-delay, 4.8s), opacity 0s linear var(--all-delay, 4.8s);
transition: transform 0.4s ease var(--all-delay, 4.8s), opacity 0s linear var(--all-delay, 4.8s), -webkit-transform 0.4s ease var(--all-delay, 4.8s);
}
.button .icon div:after {
--l: 14px;
--w: 26px;
--tx: 1px;
-webkit-transform: rotate(var(--after-rotate, 0deg));
transform: rotate(var(--after-rotate, 0deg));
}
.button .icon div svg {
stroke: var(--active);
}
.button .icon div svg.arrow {
width: 40px;
height: 32px;
opacity: var(--arrow-opacity, 1);
-webkit-transition: opacity 0s linear var(--all-delay, 1s);
transition: opacity 0s linear var(--all-delay, 1s);
}
.button .icon div svg.progress {
width: 444px;
height: 10px;
position: absolute;
left: 0;
top: 11px;
-webkit-transform: translateX(var(--progress-x, 0));
transform: translateX(var(--progress-x, 0));
opacity: var(--progress-opacity, 0);
-webkit-transition: opacity 0s linear var(--all-delay, 1s), -webkit-transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s);
transition: opacity 0s linear var(--all-delay, 1s), -webkit-transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s);
transition: transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s), opacity 0s linear var(--all-delay, 1s);
transition: transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s), opacity 0s linear var(--all-delay, 1s), -webkit-transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s);
-webkit-animation: var(--hide, none) 0s linear forwards var(--all-delay, 4.8s);
animation: var(--hide, none) 0s linear forwards var(--all-delay, 4.8s);
}
.button.loading:not(.reset) {
--line-y: -36px;
--line-array: 0;
--line-offset: 15px;
--active-offset: 0;
--arrow-opacity: 0;
--progress-opacity: 1;
--progress-x: -400px;
--tick-opacity: 1;
--before-rotate: 47deg;
--after-rotate: -46deg;
--hide: hide;
--overflow: overflow;
--icon-x: 2px;
--icon-y: 7px;
--count-opacity: 1;
--count-y: 0;
--count: count;
}
.button.reset {
--all-delay: 0s;
--all-transition: .3s;
}
@-webkit-keyframes hide {
to {
opacity: 0;
}
}
@keyframes hide {
to {
opacity: 0;
}
}
@-webkit-keyframes count {
to {
-webkit-transform: translateY(4px);
transform: translateY(4px);
opacity: 0;
}
}
@keyframes count {
to {
-webkit-transform: translateY(4px);
transform: translateY(4px);
opacity: 0;
}
}
@-webkit-keyframes overflow {
to {
overflow: visible;
}
}
@keyframes overflow {
to {
overflow: visible;
}
}
body {
min-height: 100vh;
font-family: 'Inter', 'Inter UI', Arial;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
background: #275EFE;
font-family: 'Roboto', Arial, sans-serif;
}
</style>
<button class="button">
<svg class="circle" viewBox="0 0 76 76">
<circle class="default" cx="38" cy="38" r="36"></circle>
<circle class="active" cx="38" cy="38" r="36"></circle>
</svg>
<div class="icon">
<svg class="line" viewBox="0 0 4 37">
<line x1="2" y1="2" x2="2" y2="35"></line>
</svg>
<div>
<svg class="arrow" viewBox="0 0 40 32"></svg>
<svg class="progress" viewBox="0 0 444 10">
<path d="M2,5 L42,5 C60.0089086,6.33131695 73.3422419,6.99798362 82,7 C87.572404,7.00129781 91.0932494,1.72677301 102,1.99944178 C112.906751,2.27211054 112.000464,7.99986045 122,8 C131.999536,8.00013955 132,2 142,2 C152,2 152,8 162,8 C172,8 172,2 182,2 C192,2 192,8 202,8 C212,8 212,2 222,2 C232,2 232,8 242,8 C252,8 252,2 262,2 C272,2 272,8 282,8 C292,8 292,2 302,2 C312,2 312,8 322,8 C332,8 332,2 342,2 C352,2 351.897852,7.49489262 362,8 C372.102148,8.50510738 378.620177,5.22532154 402,5 L442,5"></path>
</svg>
</div>
</div>
<span>0%</span>
</button>
<br><!-- -- --><br>
<div class="dl">
<div class="dl-box">
<div class="dl-button">
<div class="arrow"></div>
<div class="basket">
<div class="basket-top"></div>
</div>
</div>
<div class="dl-progress">
<div class="check">
<svg>
<use xlink:href="#check" />
</svg>
</div>
</div>
</div>
<div class="dl-status">
<div class="text text-file">Status</div>
<div class="text text-number"></div>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130 130" id="check">
<polyline points="100.2,40.2 51.5,88.8 29.8,67.5 " />
</symbol>
</svg>
<script src='https://www.htmlbestcodes.com/uploads/other/gsap.min.js'></script>
<script>
var $ = (s, o = document) => o.querySelector(s);
$(".dl").addEventListener("click", function () {
this.classList.add("run");
setTimeout(() => this.classList.add("done"), 4000);
setTimeout(() => this.classList.remove("done"), 5500);
setTimeout(() => this.classList.remove("run"), 5500);
});
////
const $$ = (s, o = document) => o.querySelectorAll(s);
$$('.button').forEach(button => {
let count = {
number: 0 },
icon = $('.icon', button),
iconDiv = $('.icon > div', button),
arrow = $('.icon .arrow', button),
countElem = $('span', button),
svgPath = new Proxy({
y: null,
s: null,
f: null,
l: null },
{
set(target, key, value) {
target[key] = value;
if (target.y !== null && target.s != null && target.f != null && target.l != null) {
arrow.innerHTML = getPath(target.y, target.f, target.l, target.s, null);
}
return true;
},
get(target, key) {
return target[key];
} });
svgPath.y = 30;
svgPath.s = 0;
svgPath.f = 8;
svgPath.l = 32;
button.addEventListener('click', e => {
if (!button.classList.contains('loading')) {
if (!button.classList.contains('animation')) {
button.classList.add('loading', 'animation');
gsap.to(svgPath, {
f: 2,
l: 38,
duration: .3,
delay: .15 });
gsap.to(svgPath, {
s: .2,
y: 16,
duration: .8,
delay: .15,
ease: Elastic.easeOut.config(1, .4) });
gsap.to(count, {
number: '100',
duration: 3.8,
delay: .8,
onUpdate() {
countElem.innerHTML = Math.round(count.number) + '%';
} });
setTimeout(() => {
iconDiv.style.setProperty('overflow', 'visible');
setTimeout(() => {
button.classList.remove('animation');
}, 600);
}, 4820);
}
} else {
if (!button.classList.contains('animation')) {
button.classList.add('reset');
gsap.to(svgPath, {
f: 8,
l: 32,
duration: .4 });
gsap.to(svgPath, {
s: 0,
y: 30,
duration: .4 });
setTimeout(() => {
button.classList.remove('loading', 'reset');
iconDiv.removeAttribute('style');
}, 400);
}
}
e.preventDefault();
});
});
function getPoint(point, i, a, smoothing) {
let cp = (current, previous, next, reverse) => {
let p = previous || current,
n = next || current,
o = {
length: Math.sqrt(Math.pow(n[0] - p[0], 2) + Math.pow(n[1] - p[1], 2)),
angle: Math.atan2(n[1] - p[1], n[0] - p[0]) },
angle = o.angle + (reverse ? Math.PI : 0),
length = o.length * smoothing;
return [current[0] + Math.cos(angle) * length, current[1] + Math.sin(angle) * length];
},
cps = cp(a[i - 1], a[i - 2], point, false),
cpe = cp(point, a[i - 1], a[i + 1], true);
return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}`;
}
function getPath(update, first, last, smoothing, pointsNew) {
let points = pointsNew ? pointsNew : [
[first, 16],
[20, update],
[last, 16]],
d = points.reduce((acc, point, i, a) => i === 0 ? `M ${point[0]},${point[1]}` : `${acc} ${getPoint(point, i, a, smoothing)}`, '');
return `<path d="${d}" />`;
}
</script><a target='_blank' href='https://www.htmlbestcodes.com' style='font-size: 8pt; text-decoration: none'>Html Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!