simplify spinner animation

pull/629/head
Cory LaViska 2021-12-14 13:34:06 -05:00
rodzic fb20155485
commit 125392ce57
2 zmienionych plików z 6 dodań i 9 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
- 🚨 BREAKING: removed `base` part from `<sl-divider>` to simplify the styling API
- Fixed bug where setting `tooltipFormatter` on `<sl-range>` in JSX causes React@experimental to error out
- Refactored `<sl-button>` to use Lit's static expressions to reduce code
- Simplified `<sl-spinner>` animation
## 2.0.0-beta.62

Wyświetl plik

@ -8,7 +8,7 @@ export default css`
--track-width: 2px;
--track-color: rgb(128 128 128 / 25%);
--indicator-color: var(--sl-color-primary-600);
--speed: 2.5s;
--speed: 800ms;
display: inline-flex;
width: 1em;
@ -39,6 +39,9 @@ export default css`
.spinner__indicator {
stroke: var(--indicator-color);
stroke-linecap: round;
/* stroke-dasharray: (2πr x p), (2πr) where p is the percentage to display */
stroke-dasharray: calc(2 * 3.141592 * calc(0.5em - var(--track-width) / 2) * 0.75),
calc(2 * 3.141592 * calc(0.5em - var(--track-width) / 2));
transform-origin: 50% 50%;
transform: rotate(90deg);
animation: spin var(--speed) linear infinite;
@ -46,18 +49,11 @@ export default css`
@keyframes spin {
0% {
stroke-dasharray: 0.2em 3em;
transform: rotate(0deg);
}
50% {
stroke-dasharray: 2.2em 3em;
transform: rotate(450deg);
}
100% {
stroke-dasharray: 0.2em 3em;
transform: rotate(1080deg);
transform: rotate(360deg);
}
}
`;