index.scss 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. @import '@/uni_modules/lime-style/index.scss';
  2. $loading-color: create-var(loading-color, $primary-color);
  3. $loading-size: create-var(loading-size, 20px);
  4. $loading-text-color: create-var(loading-text-color, $text-color-3);
  5. $loading-font-size: create-var(loading-font-size, $font-size);
  6. /* #ifndef MP-ALIPAY */
  7. $loading-duration: create-var(loading-duration, 2s);
  8. /* #endif */
  9. /* #ifdef MP-ALIPAY */
  10. $loading-duration: create-var(loading-duration, 1s);
  11. /* #endif */
  12. /* #ifndef APP-NVUE */
  13. /* #ifndef MP-ALIPAY */
  14. @property --l-loading-start {
  15. syntax: '<length-percentage>';
  16. initial-value: 1%;
  17. inherits: false;
  18. }
  19. @property --l-loading-end {
  20. syntax: '<length-percentage>';
  21. initial-value: 1%;
  22. inherits: false;
  23. }
  24. @property --l-left {
  25. syntax: '<length-percentage>';
  26. initial-value: 1%;
  27. inherits: false;
  28. }
  29. @property --l-loadding-ball-size {
  30. syntax: '<length> | <length-percentage>';
  31. // initial-value: 1%;
  32. inherits: false;
  33. }
  34. /* #endif */
  35. :host {
  36. display: inline-flex;
  37. }
  38. /* #endif */
  39. .l-loading {
  40. position: relative;
  41. // color: #c8c9cc;
  42. color: $loading-color;
  43. font-size: 0;
  44. vertical-align: middle;
  45. &--ball{
  46. display: inline-flex;
  47. align-items: center;
  48. .l-loading {
  49. &__ball {
  50. position: relative;
  51. perspective: calc(var(--l-loadding-ball-size) * 4);
  52. transform-style: preserve-3d;
  53. // border: 1px solid;
  54. &:before{
  55. background-color: $primary-color;
  56. left: 0%;
  57. // mix-blend-mode: darken;
  58. animation-name: l-ball-before;
  59. }
  60. &:after{
  61. right: 0;
  62. background-color: red;
  63. // mix-blend-mode: darken;
  64. animation-name: l-ball-after;
  65. }
  66. &:before,&:after{
  67. top: 0;
  68. content: '';
  69. position: absolute;
  70. // width: 100%;
  71. height: 100%;
  72. aspect-ratio: 1/1;
  73. border-radius: 50%;
  74. animation-iteration-count: infinite;
  75. animation-delay: -100ms;
  76. animation-duration: 900ms;
  77. mix-blend-mode: darken;
  78. animation-play-state: var(--l-play-state, running);
  79. }
  80. }
  81. }
  82. }
  83. &--circular {
  84. .l-loading {
  85. &__circular {
  86. display: inline-block;
  87. position: relative;
  88. /* #ifndef APP-NVUE */
  89. animation: l-rotate $loading-duration linear infinite;
  90. vertical-align: middle;
  91. animation-play-state: var(--l-play-state, running);
  92. &:before {
  93. content: '';
  94. display: block;
  95. width: 100%;
  96. height: 100%;
  97. border-radius: 50%;
  98. /* #ifndef MP-ALIPAY || APP-VUE */
  99. background-image: conic-gradient(
  100. transparent 0%,
  101. transparent var(--l-loading-start, 0%), var(--l-loading-color-1, currentColor) var(--l-loading-start, 0%),
  102. var(--l-loading-color-2, currentColor) var(--l-loading-end, 0%), transparent var(--l-loading-end, 0%),
  103. transparent 100%);
  104. /* #endif */
  105. /* #ifdef MP-ALIPAY || APP-VUE */
  106. background-image: conic-gradient(
  107. var(--l-loading-color-1, transparent) 0%,
  108. var(--l-loading-color-2, currentColor) 100%);
  109. /* #endif */
  110. mask: radial-gradient(closest-side, transparent calc(80% - 1px), #fff 80%);
  111. -webkit-mask: radial-gradient(closest-side, transparent calc(80% - 1px), #fff 80%);
  112. animation: l-circular 2.5s ease-in-out infinite;
  113. transform: rotate(90deg);
  114. animation-play-state: var(--l-play-state, running);
  115. }
  116. /* #endif */
  117. }
  118. }
  119. }
  120. &--spinner {
  121. .l-loading {
  122. &__spinner {
  123. position: relative;
  124. box-sizing: border-box;
  125. width: 100%;
  126. height: 100%;
  127. max-width: 100%;
  128. max-height: 100%;
  129. animation-timing-function: steps(12);
  130. animation: l-rotate 0.8s linear infinite;
  131. animation-play-state: var(--l-play-state, running);
  132. }
  133. &__dot {
  134. position: absolute;
  135. top: 0;
  136. left: 0;
  137. width: 100%;
  138. height: 100%;
  139. transform: rotate(calc(var(--l-loading-dot, 1) * 30deg));
  140. opacity: calc(var(--l-loading-dot, 1) / 12);
  141. &::before {
  142. display: block;
  143. width: 5rpx;
  144. height: 25%;
  145. margin: 0 auto;
  146. background-color: currentColor;
  147. border-radius: 40%;
  148. content: ' ';
  149. }
  150. }
  151. }
  152. }
  153. &__text{
  154. display: inline-block;
  155. margin-left: $spacer-xs;
  156. color: $loading-text-color;
  157. font-size: $loading-font-size;
  158. vertical-align: middle;
  159. }
  160. &.is-vertical {
  161. display: inline-flex;
  162. flex-direction: column;
  163. align-items: center;
  164. .l-loading__text {
  165. margin: $spacer-tn 0 0;
  166. }
  167. }
  168. &__ball,&__circular,&__spinner {
  169. width: $loading-size;
  170. height: $loading-size;
  171. }
  172. }
  173. /* #ifndef APP-NVUE */
  174. @keyframes l-circular {
  175. 0% {
  176. --l-loading-start: 0%;
  177. --l-loading-end: 0%;
  178. }
  179. 50% {
  180. --l-loading-start: 0%;
  181. --l-loading-end: 100%;
  182. }
  183. 100% {
  184. --l-loading-start: 100%;
  185. --l-loading-end: 100%;
  186. }
  187. }
  188. @keyframes l-rotate {
  189. to {
  190. transform: rotate(1turn)
  191. }
  192. }
  193. @keyframes l-ball-before {
  194. 0%{
  195. animation-timing-function: ease-in;
  196. }
  197. 25% {
  198. animation-timing-function: ease-out;
  199. --l-left: calc((var(--l-loadding-ball-size,100%) * 2.1 - var(--l-loadding-ball-size,100%)) / 2);
  200. transform: translate3d(var(--l-left), 0, var(--l-loadding-ball-size));
  201. }
  202. 50% {
  203. --l-left: calc((var(--l-loadding-ball-size,100%) * 2.1 - var(--l-loadding-ball-size,100%)));
  204. animation-timing-function:ease-in;
  205. transform: translate3d(var(--l-left), 0, 0);
  206. }
  207. 75% {
  208. animation-timing-function: ease-out;
  209. --l-left: calc((var(--l-loadding-ball-size,100%) * 2.1 - var(--l-loadding-ball-size,100%)) / 2);
  210. transform: translate3d(var(--l-left), 0, calc(var(--l-loadding-ball-size) * -1));
  211. }
  212. }
  213. @keyframes l-ball-after {
  214. 0%{
  215. animation-timing-function: ease-in;
  216. }
  217. 25% {
  218. animation-timing-function: ease-out;
  219. --l-left: calc((var(--l-loadding-ball-size,100%) * 2.1 - var(--l-loadding-ball-size,100%)) / 2 * -1);
  220. transform: translate3d(var(--l-left), 0, calc(var(--l-loadding-ball-size) * -1));
  221. }
  222. 50% {
  223. animation-timing-function:ease-in;
  224. --l-left: calc((var(--l-loadding-ball-size,100%) * 2.1 - var(--l-loadding-ball-size,100%)) * -1);
  225. transform: translate3d(var(--l-left), 0, 0);
  226. }
  227. 75% {
  228. animation-timing-function: ease-out;
  229. --l-left: calc((var(--l-loadding-ball-size,100%) * 2.1 - var(--l-loadding-ball-size,100%)) / 2 * -1);
  230. transform: translate3d(var(--l-left), 0, var(--l-loadding-ball-size));
  231. }
  232. }
  233. /* #endif */