_animated.scss 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // animating icons
  2. // --------------------------
  3. @use 'variables' as v;
  4. .#{v.$css-prefix}-beat {
  5. animation-name: #{v.$css-prefix}-beat;
  6. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  7. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  8. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  9. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  10. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, ease-in-out);
  11. }
  12. .#{v.$css-prefix}-bounce {
  13. animation-name: #{v.$css-prefix}-bounce;
  14. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  15. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  16. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  17. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  18. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, cubic-bezier(0.280, 0.840, 0.420, 1));
  19. }
  20. .#{v.$css-prefix}-fade {
  21. animation-name: #{v.$css-prefix}-fade;
  22. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  23. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  24. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  25. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  26. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, cubic-bezier(.4,0,.6,1));
  27. }
  28. .#{v.$css-prefix}-beat-fade {
  29. animation-name: #{v.$css-prefix}-beat-fade;
  30. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  31. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  32. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  33. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  34. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, cubic-bezier(.4,0,.6,1));
  35. }
  36. .#{v.$css-prefix}-flip {
  37. animation-name: #{v.$css-prefix}-flip;
  38. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  39. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  40. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  41. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  42. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, ease-in-out);
  43. }
  44. .#{v.$css-prefix}-shake {
  45. animation-name: #{v.$css-prefix}-shake;
  46. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  47. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  48. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  49. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  50. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, linear);
  51. }
  52. .#{v.$css-prefix}-spin {
  53. animation-name: #{v.$css-prefix}-spin;
  54. animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
  55. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  56. animation-duration: var(--#{v.$css-prefix}-animation-duration, 2s);
  57. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  58. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, linear);
  59. }
  60. .#{v.$css-prefix}-spin-reverse {
  61. --#{v.$css-prefix}-animation-direction: reverse;
  62. }
  63. .#{v.$css-prefix}-pulse,
  64. .#{v.$css-prefix}-spin-pulse {
  65. animation-name: #{v.$css-prefix}-spin;
  66. animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
  67. animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
  68. animation-iteration-count: var(--#{v.$css-prefix}-animation-iteration-count, infinite);
  69. animation-timing-function: var(--#{v.$css-prefix}-animation-timing, steps(8));
  70. }
  71. // if agent or operating system prefers reduced motion, disable animations
  72. // see: https://www.smashingmagazine.com/2020/09/design-reduced-motion-sensitivities/
  73. // see: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
  74. @media (prefers-reduced-motion: reduce) {
  75. .#{v.$css-prefix}-beat,
  76. .#{v.$css-prefix}-bounce,
  77. .#{v.$css-prefix}-fade,
  78. .#{v.$css-prefix}-beat-fade,
  79. .#{v.$css-prefix}-flip,
  80. .#{v.$css-prefix}-pulse,
  81. .#{v.$css-prefix}-shake,
  82. .#{v.$css-prefix}-spin,
  83. .#{v.$css-prefix}-spin-pulse {
  84. animation: none !important;
  85. transition: none !important;
  86. }
  87. }
  88. @keyframes #{v.$css-prefix}-beat {
  89. 0%, 90% { transform: scale(1); }
  90. 45% { transform: scale(var(--#{v.$css-prefix}-beat-scale, 1.25)); }
  91. }
  92. @keyframes #{v.$css-prefix}-bounce {
  93. 0% { transform: scale(1,1) translateY(0); }
  94. 10% { transform: scale(var(--#{v.$css-prefix}-bounce-start-scale-x, 1.1),var(--#{v.$css-prefix}-bounce-start-scale-y, 0.9)) translateY(0); }
  95. 30% { transform: scale(var(--#{v.$css-prefix}-bounce-jump-scale-x, 0.9),var(--#{v.$css-prefix}-bounce-jump-scale-y, 1.1)) translateY(var(--#{v.$css-prefix}-bounce-height, -0.5em)); }
  96. 50% { transform: scale(var(--#{v.$css-prefix}-bounce-land-scale-x, 1.05),var(--#{v.$css-prefix}-bounce-land-scale-y, 0.95)) translateY(0); }
  97. 57% { transform: scale(1,1) translateY(var(--#{v.$css-prefix}-bounce-rebound, -0.125em)); }
  98. 64% { transform: scale(1,1) translateY(0); }
  99. 100% { transform: scale(1,1) translateY(0); }
  100. }
  101. @keyframes #{v.$css-prefix}-fade {
  102. 50% { opacity: var(--#{v.$css-prefix}-fade-opacity, 0.4); }
  103. }
  104. @keyframes #{v.$css-prefix}-beat-fade {
  105. 0%, 100% {
  106. opacity: var(--#{v.$css-prefix}-beat-fade-opacity, 0.4);
  107. transform: scale(1);
  108. }
  109. 50% {
  110. opacity: 1;
  111. transform: scale(var(--#{v.$css-prefix}-beat-fade-scale, 1.125));
  112. }
  113. }
  114. @keyframes #{v.$css-prefix}-flip {
  115. 50% {
  116. transform: rotate3d(var(--#{v.$css-prefix}-flip-x, 0), var(--#{v.$css-prefix}-flip-y, 1), var(--#{v.$css-prefix}-flip-z, 0), var(--#{v.$css-prefix}-flip-angle, -180deg));
  117. }
  118. }
  119. @keyframes #{v.$css-prefix}-shake {
  120. 0% { transform: rotate(-15deg); }
  121. 4% { transform: rotate(15deg); }
  122. 8%, 24% { transform: rotate(-18deg); }
  123. 12%, 28% { transform: rotate(18deg); }
  124. 16% { transform: rotate(-22deg); }
  125. 20% { transform: rotate(22deg); }
  126. 32% { transform: rotate(-12deg); }
  127. 36% { transform: rotate(12deg); }
  128. 40%, 100% { transform: rotate(0deg); }
  129. }
  130. @keyframes #{v.$css-prefix}-spin {
  131. 0% { transform: rotate(0deg); }
  132. 100% { transform: rotate(360deg); }
  133. }