amis/packages/amis-ui/scss/components/_spinner.scss
2022-06-01 15:06:00 +08:00

177 lines
2.9 KiB
SCSS

@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
to {
transform: rotate(1turn);
}
}
.#{$ns}Spinner {
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
transition: ease-out opacity var(--animation-duration);
&.in {
opacity: 1;
}
.#{$ns}Spinner-icon {
width: var(--Spinner-width);
height: var(--Spinner-height);
position: relative;
transform: translateZ(0);
animation: spin 2s linear infinite;
transition: ease-out all var(--animation-duration);
&--default {
background: var(--Spinner-bg);
background-size: 100%;
animation: none;
}
&--simple {
background: transparent;
display: flex;
align-items: center;
justify-content: center;
.icon {
width: 100%;
height: 100%;
color: var(--Spinner-color);
}
svg.icon {
top: 0;
path {
fill: var(--Spinner-color);
}
}
i.icon {
display: flex;
align-items: center;
justify-content: center;
font-size: var(--Spinner-width);
}
}
&--custom {
width: auto;
height: auto;
}
&--lg {
width: var(--Spinner--lg-width);
height: var(--Spinner--lg-height);
i.icon {
font-size: var(--Spinner--lg-height);
}
}
&--sm {
width: var(--Spinner--sm-width);
height: var(--Spinner--sm-height);
i.icon {
font-size: var(--Spinner--sm-height);
}
}
}
.#{$ns}Spinner-tip {
margin: px2rem(12px) 0 0 0;
word-break: keep-all;
white-space: nowrap;
color: var(--Spinner-color);
}
&.#{$ns}Spinner-tip--top {
flex-direction: column-reverse;
.#{$ns}Spinner-tip {
margin: 0 0 px2rem(12px) 0;
}
}
&.#{$ns}Spinner-tip--right {
flex-direction: row;
.#{$ns}Spinner-tip {
margin: 0 0 0 px2rem(12px);
}
}
&.#{$ns}Spinner-tip--bottom {
flex-direction: column;
.#{$ns}Spinner-tip {
margin: px2rem(12px) 0 0 0;
}
}
&.#{$ns}Spinner-tip--left {
flex-direction: row-reverse;
.#{$ns}Spinner-tip {
margin: 0 px2rem(12px) 0 0;
}
}
&--overlay {
position: absolute;
z-index: 11;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
}
.#{$ns}Spinner-overlay {
position: absolute;
z-index: 10;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--Spinner-overlay-bg);
transition: ease-out opacity var(--animation-duration);
opacity: 0;
&.in {
opacity: 1;
}
}
// spinner渲染器scss
.#{$ns}Spinner-wrap {
position: relative;
width: 100%;
height: 100%;
.#{$ns}Spinner {
position: absolute;
z-index: 11;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
}