|
| 1 | +*{ |
| 2 | + margin: 0; |
| 3 | + padding: 0; |
| 4 | +} |
| 5 | +.body { |
| 6 | + background-color: black; |
| 7 | + min-height: 100vh; |
| 8 | + display: flex; |
| 9 | + justify-content: center; |
| 10 | + align-items: center; |
| 11 | + margin: 0; |
| 12 | +} |
| 13 | + |
| 14 | +:root { |
| 15 | + --squish-animation-time: 500ms; |
| 16 | + --progress-animation-time: 1000ms; |
| 17 | + --circle-animation-time: 300ms; |
| 18 | + --checkmark-animation-time: 300ms; |
| 19 | + --btn-width: 125px; |
| 20 | + --btn-height: 40px; |
| 21 | +} |
| 22 | + |
| 23 | +.btn { |
| 24 | + position: relative; |
| 25 | + background-color: #2b2d2f; |
| 26 | + color: #71dfbe; |
| 27 | + border: none; |
| 28 | + border-radius: 0.125em; |
| 29 | + width: var(--btn-width); |
| 30 | + height: var(--btn-height); |
| 31 | + font-weight: bold; |
| 32 | + cursor: pointer; |
| 33 | + padding: 0; |
| 34 | +} |
| 35 | + |
| 36 | +.btn.animating { |
| 37 | + background-color: transparent; |
| 38 | + color: transparent; |
| 39 | + user-select: none; |
| 40 | + cursor: default; |
| 41 | + animation: hide 0ms |
| 42 | + calc(var(--squish-animation-time) + var(--progress-animation-time)) forwards; |
| 43 | +} |
| 44 | + |
| 45 | +.btn::before { |
| 46 | + content: ""; |
| 47 | + display: none; |
| 48 | + position: absolute; |
| 49 | + background-color: #2b2d2f; |
| 50 | + inset: 0; |
| 51 | + border-radius: 0.125em; |
| 52 | + animation: squish var(--squish-animation-time) |
| 53 | + cubic-bezier(0.26, 0.6, 0.46, 1.7); |
| 54 | + animation-fill-mode: forwards; |
| 55 | +} |
| 56 | + |
| 57 | +.btn::after { |
| 58 | + content: ""; |
| 59 | + display: none; |
| 60 | + position: absolute; |
| 61 | + background-color: #aaa; |
| 62 | + left: 51%; |
| 63 | + right: 51%; |
| 64 | + top: 45%; |
| 65 | + bottom: 45%; |
| 66 | + border-radius: 0.25em; |
| 67 | + animation: progress var(--progress-animation-time) |
| 68 | + var(--squish-animation-time); |
| 69 | + animation-fill-mode: forwards; |
| 70 | +} |
| 71 | + |
| 72 | +.btn.animating::before, |
| 73 | +.btn.animating::after { |
| 74 | + display: block; |
| 75 | +} |
| 76 | + |
| 77 | +.btn.animating + .checkmark-container { |
| 78 | + background-color: #2b2d2f; |
| 79 | + border-radius: 0.25em; |
| 80 | + width: 0; |
| 81 | + height: 0; |
| 82 | + animation: circle var(--circle-animation-time) |
| 83 | + calc(var(--squish-animation-time) + var(--progress-animation-time)) forwards |
| 84 | + cubic-bezier(0.26, 0.6, 0.46, 1.7); |
| 85 | + display: flex; |
| 86 | + justify-content: center; |
| 87 | + align-items: center; |
| 88 | +} |
| 89 | + |
| 90 | +.btn.animating + .checkmark-container .checkmark-svg { |
| 91 | + stroke: white; |
| 92 | + width: 25px; |
| 93 | + stroke-dashoffset: 40.84104919433594; |
| 94 | + stroke-dasharray: 40.84104919433594; |
| 95 | + stroke-linecap: round; |
| 96 | + stroke-linejoin: round; |
| 97 | + stroke-width: 3px; |
| 98 | + animation: checkmark var(--circle-animation-time) |
| 99 | + calc( |
| 100 | + var(--squish-animation-time) + var(--progress-animation-time) + |
| 101 | + var(--circle-animation-time) |
| 102 | + ) |
| 103 | + forwards; |
| 104 | +} |
| 105 | + |
| 106 | +@keyframes squish { |
| 107 | + 100% { |
| 108 | + left: -25%; |
| 109 | + right: -25%; |
| 110 | + top: 45%; |
| 111 | + bottom: 45%; |
| 112 | + border-radius: 0.25em; |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +@keyframes progress { |
| 117 | + 100% { |
| 118 | + left: -25%; |
| 119 | + right: -25%; |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +@keyframes hide { |
| 124 | + 100% { |
| 125 | + width: 0; |
| 126 | + height: 0; |
| 127 | + } |
| 128 | +} |
| 129 | + |
| 130 | +@keyframes circle { |
| 131 | + 0% { |
| 132 | + width: calc(var(--btn-width) * 1.5); |
| 133 | + height: calc(var(--btn-height) * 0.1); |
| 134 | + } |
| 135 | + 100% { |
| 136 | + background-color: #71dfbe; |
| 137 | + width: 50px; |
| 138 | + height: 50px; |
| 139 | + border-radius: 100%; |
| 140 | + } |
| 141 | +} |
| 142 | + |
| 143 | +@keyframes checkmark { |
| 144 | + 100% { |
| 145 | + stroke-dashoffset: 0; |
| 146 | + } |
| 147 | +} |
0 commit comments