_shadow.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* ==================
  2. 阴影
  3. ==================== */
  4. .shadow {
  5. box-shadow: var(--ui-Shadow);
  6. &-sm {
  7. box-shadow: var(--ui-Shadow-sm);
  8. }
  9. &-lg {
  10. box-shadow: var(--ui-Shadow-lg);
  11. }
  12. &-inset {
  13. box-shadow: var(--ui-Shadow-inset);
  14. }
  15. @each $color, $value in $colors {
  16. @at-root .shadow-#{$color} {
  17. box-shadow: 0 0.5em 1em rgba($value, var(--ui-Shadow-opacity));
  18. }
  19. &-sm.shadow-#{$color} {
  20. box-shadow: 0 0.125em 0.25em rgba($value, var(--ui-Shadow-opacity));
  21. }
  22. &-lg.shadow-#{$color} {
  23. box-shadow: 0 1em 3em rgba($value, var(--ui-Shadow-opacity-lg));
  24. }
  25. }
  26. &-warp {
  27. position: relative;
  28. }
  29. &-warp:before,
  30. &-warp:after {
  31. position: absolute;
  32. content: '';
  33. bottom: -10rpx;
  34. left: 20rpx;
  35. width: calc(50% - #{40rpx});
  36. height: 30rpx;
  37. transform: skew(0deg, -6deg);
  38. transform-origin: 50% 50%;
  39. background-color: rgba(0, 0, 0, var(--ui-Shadow-opacity));
  40. filter: blur(20rpx);
  41. z-index: -1;
  42. opacity: 0.5;
  43. }
  44. &-warp:after {
  45. right: 20rpx;
  46. left: auto;
  47. transform: skew(0deg, 6deg);
  48. }
  49. &-blur {
  50. position: relative;
  51. }
  52. &-blur::before {
  53. content: '';
  54. display: block;
  55. background: inherit;
  56. filter: blur(20rpx);
  57. position: absolute;
  58. width: 100%;
  59. height: 100%;
  60. top: 0.5em;
  61. left: 0.5em;
  62. z-index: -1;
  63. opacity: var(--ui-Shadow-opacity-lg);
  64. transform-origin: 0 0;
  65. border-radius: inherit;
  66. transform: scale(1, 1);
  67. }
  68. }
  69. .drop-shadow {
  70. filter: drop-shadow(0 0 30rpx rgba(0, 0, 0, 0.1));
  71. &-sm {
  72. filter: drop-shadow(0 4rpx 4rpx rgba(0, 0, 0, 0.06));
  73. }
  74. &-lg {
  75. filter: drop-shadow(0 30rpx 60rpx rgba(0, 0, 0, 0.2));
  76. }
  77. @each $color, $value in $colors {
  78. @at-root .drop-shadow-#{$color} {
  79. filter: drop-shadow(0 15rpx 15rpx rgba(darken($value, 10%), 0.3));
  80. }
  81. &-sm.drop-shadow-#{$color} {
  82. filter: drop-shadow(0 4rpx 4rpx rgba(darken($value, 10%), 0.3));
  83. }
  84. &-lg.drop-shadow-#{$color} {
  85. filter: drop-shadow(0 50rpx 100rpx rgba(darken($value, 10%), 0.2));
  86. }
  87. }
  88. }