|
81 | 81 | $diameter: calc(var(--circular-size) + var(--stroke-thickness)); |
82 | 82 | $radius: calc(var(--circular-size) / 2 - var(--stroke-thickness) * .5); |
83 | 83 | $circumference: calc(#{$radius} * 2 * 3.1416); |
84 | | - |
85 | 84 | $variant: map.get($theme, '_meta', 'variant'); |
86 | | - $stroke-width: rem(4px); |
87 | | - |
88 | | - $font-size: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness)), 1px); |
89 | | - $font-size-fraction: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness) - rem(2px)), 1px); |
90 | 85 |
|
91 | 86 | %display-circular { |
92 | 87 | --circular-size: calc(#{var-get($theme, 'diameter')} - var(--stroke-thickness)); |
|
128 | 123 |
|
129 | 124 | %outer { |
130 | 125 | @if $variant != 'bootstrap' { |
131 | | - animation: initial-dashoffset var(--_transition-duration) linear; |
| 126 | + animation: igx-initial-dashoffset var(--_transition-duration) linear; |
132 | 127 | } @else { |
133 | 128 | stroke-width: var(--stroke-thickness); |
134 | 129 | } |
|
142 | 137 | %display-circular:not(%display-circular--indeterminate) { |
143 | 138 | svg { |
144 | 139 | %outer { |
145 | | - animation: initial-dashoffset var(--_transition-duration) linear; |
| 140 | + animation: igx-initial-dashoffset var(--_transition-duration) linear; |
146 | 141 | stroke-dasharray: #{$circumference} #{$circumference}; |
147 | 142 | stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference}); |
148 | 143 | } |
|
152 | 147 | %display-circular:dir(rtl):not(%display-circular--indeterminate) { |
153 | 148 | svg { |
154 | 149 | %outer { |
155 | | - animation: initial-dashoffset-rtl var(--_transition-duration) linear; |
| 150 | + animation: igx-initial-dashoffset-rtl var(--_transition-duration) linear; |
156 | 151 | animation-direction: reverse; |
157 | 152 | } |
158 | 153 | } |
159 | 154 | } |
160 | 155 |
|
161 | 156 | %display-circular--indeterminate { |
162 | 157 | svg { |
163 | | - animation: 3s linear 0s infinite $animation-direction none running rotate-center; |
| 158 | + @if $variant != 'fluent' { |
| 159 | + animation: 3s linear 0s infinite $animation-direction none running rotate-center; |
| 160 | + } |
164 | 161 |
|
165 | 162 | @if $variant != 'bootstrap' { |
166 | 163 | transform-origin: 50% 50%; |
|
179 | 176 |
|
180 | 177 | @if $variant == 'fluent' { |
181 | 178 | stroke-linecap: round; |
182 | | - animation: 2s linear 0s infinite normal none running indeterminate-circular-fluent |
| 179 | + animation: 2s linear 0s infinite normal none running igx-indeterminate-circular-fluent |
183 | 180 | } @else { |
184 | | - animation: indeterminate-accordion 1.5s cubic-bezier(0, 0.085, 0.68, 0.53) $animation-direction infinite; |
| 181 | + animation: igx-indeterminate-accordion 1.5s cubic-bezier(0, 0.085, 0.68, 0.53) $animation-direction infinite; |
185 | 182 | } |
186 | 183 |
|
187 | 184 | @if $variant == 'bootstrap' { |
|
198 | 195 |
|
199 | 196 | %outer { |
200 | 197 | @if $variant == 'fluent' { |
201 | | - animation-name: indeterminate-circular-fluent-rtl; |
| 198 | + animation-name: igx-indeterminate-circular-fluent-rtl; |
202 | 199 | } |
203 | 200 |
|
204 | 201 | @if $variant == 'bootstrap' { |
|
233 | 230 | stroke-dasharray: #{$circumference} #{$circumference}; |
234 | 231 | stroke-dashoffset: calc(#{$circumference} - var(--_progress-whole, 0) * #{$circumference}); |
235 | 232 | transition: stroke-dashoffset var(--_transition-duration) linear; |
236 | | - stroke-width: calc(var(--stroke-thickness) + rem(0.75px)); |
| 233 | + |
| 234 | + @if $variant == 'material' { |
| 235 | + stroke-width: calc(var(--stroke-thickness) + rem(0.75px)); |
| 236 | + } @else { |
| 237 | + stroke-width: var(--stroke-thickness); |
| 238 | + } |
237 | 239 | } |
238 | 240 |
|
239 | 241 | %outer--indeterminate { |
240 | 242 | stroke-dasharray: 289; |
241 | | - @include animation(indeterminate-accordion 1.5s cubic-bezier(0, .085, .68, .53) normal infinite); |
| 243 | + @include animation(igx-indeterminate-accordion var(--_transition-duration) cubic-bezier(0, .085, .68, .53) normal infinite); |
242 | 244 | } |
243 | 245 |
|
244 | 246 | %inner, |
|
255 | 257 | %text { |
256 | 258 | position: absolute; |
257 | 259 | color: var-get($theme, 'text-color'); |
258 | | - |
| 260 | + font-size: round(calc(#{var-get($theme, 'diameter')} / var(--scale-factor) - var(--stroke-thickness)), 1px); |
259 | 261 | line-height: normal; |
260 | 262 | text-align: center; |
261 | 263 | font-weight: 600; |
|
264 | 266 | font-weight: 700; |
265 | 267 | } |
266 | 268 |
|
| 269 | + animation: igx-initial-counter var(--_transition-duration) ease-in-out; |
267 | 270 | counter-reset: |
268 | 271 | progress-integer var(--_progress-integer, 0) |
269 | 272 | progress-fraction var(--_progress-fraction, 0); |
|
273 | 276 | } |
274 | 277 |
|
275 | 278 | %text:not(%text--fraction) { |
276 | | - font-size: #{$font-size}; |
277 | | - |
278 | 279 | &::before { |
279 | 280 | content: counter(progress-integer) '%'; |
280 | 281 | } |
281 | 282 | } |
282 | 283 |
|
283 | 284 | %text--fraction { |
284 | | - font-size: #{$font-size-fraction}; |
285 | | - |
286 | 285 | &::before { |
287 | 286 | content: counter(progress-integer) '.' counter(progress-fraction, decimal-leading-zero) '%'; |
288 | 287 | } |
|
300 | 299 | stop-color: var-get($theme, 'progress-circle-color-end'); |
301 | 300 | } |
302 | 301 |
|
303 | | - @keyframes indeterminate-accordion { |
| 302 | + @keyframes igx-indeterminate-accordion { |
304 | 303 | 0% { |
305 | 304 | stroke-dashoffset: calc(#{$circumference} * 2); |
306 | 305 | stroke-dasharray: calc(#{$circumference} * 9 / 10); |
|
311 | 310 | } |
312 | 311 | } |
313 | 312 |
|
314 | | - @keyframes indeterminate-accordion-rtl { |
| 313 | + @keyframes igx-indeterminate-accordion-rtl { |
315 | 314 | 0% { |
316 | 315 | stroke-dashoffset: calc(#{$circumference} * -2); |
317 | 316 | stroke-dasharray: calc(#{$circumference} * 9 / 10); |
|
324 | 323 |
|
325 | 324 | // Fluent: Circular progress animation for indeterminate state. |
326 | 325 | // Dynamically changes stroke-dasharray and rotates for a smooth spinning effect. |
327 | | - @keyframes indeterminate-circular-fluent { |
| 326 | + @keyframes igx-indeterminate-circular-fluent { |
328 | 327 | 0% { |
329 | 328 | // Start the stroke at the correct position by adjusting the dasharray and dashoffset |
330 | 329 | stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference}; |
|
355 | 354 | } |
356 | 355 | } |
357 | 356 |
|
358 | | - @keyframes indeterminate-circular-fluent-rtl { |
| 357 | + @keyframes igx-indeterminate-circular-fluent-rtl { |
359 | 358 | 0% { |
360 | 359 | stroke-dasharray: calc(#{$circumference} * 0.0001), #{$circumference}; |
361 | 360 |
|
|
381 | 380 | } |
382 | 381 | } |
383 | 382 |
|
| 383 | + @keyframes igx-initial-dashoffset { |
| 384 | + from { |
| 385 | + /* Start with no progress (0%) */ |
| 386 | + stroke-dashoffset: #{$circumference}; |
| 387 | + } |
| 388 | + |
| 389 | + to { |
| 390 | + stroke-dashoffset: calc(#{$circumference} - var(--_progress-percentage) * #{$circumference}); |
| 391 | + } |
| 392 | + } |
| 393 | + |
384 | 394 | // Generic animations |
385 | | - @keyframes rotate-center { |
| 395 | + @keyframes igc-initial-counter { |
| 396 | + from { |
| 397 | + --_progress-integer: 0; |
| 398 | + --_progress-fraction: 0; |
| 399 | + } |
| 400 | + } |
| 401 | + |
| 402 | + @keyframes igx-rotate-center { |
386 | 403 | 0% { |
387 | 404 | transform: rotate(0); |
388 | 405 | } |
|
392 | 409 | } |
393 | 410 | } |
394 | 411 |
|
395 | | - %animation-none { |
396 | | - animation-name: none; |
397 | | - animation-duration: 0s; |
| 412 | + // Reset the transition if the animate prop is set to false. |
| 413 | + %animation-none:not(%display-circular--indeterminate) { |
| 414 | + --_transition-duration: 0s !important; |
398 | 415 | } |
399 | 416 |
|
400 | 417 | %hide-counter { |
|
0 commit comments