index-u.scss 6.2 KB

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