_error.scss 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Lucas Bebber's Glitch Effect
  2. // Tutorial and CSS from CSS Tricks
  3. // https://css-tricks.com/glitch-effect-text-images-svg/
  4. .error {
  5. color: $gray-800;
  6. font-size: 7rem;
  7. position: relative;
  8. line-height: 1;
  9. width: 12.5rem;
  10. }
  11. @keyframes noise-anim {
  12. $steps: 20;
  13. @for $i from 0 through $steps {
  14. #{percentage($i*(1/$steps))} {
  15. clip: rect(random(100)+px,9999px,random(100)+px,0);
  16. }
  17. }
  18. }
  19. .error:after {
  20. content: attr(data-text);
  21. position: absolute;
  22. left: 2px;
  23. text-shadow: -1px 0 $red;
  24. top: 0;
  25. color: $gray-800;
  26. background: $gray-100;
  27. overflow: hidden;
  28. clip: rect(0,900px,0,0);
  29. animation: noise-anim 2s infinite linear alternate-reverse;
  30. }
  31. @keyframes noise-anim-2 {
  32. $steps: 20;
  33. @for $i from 0 through $steps {
  34. #{percentage($i*(1/$steps))} {
  35. clip: rect(random(100)+px,9999px,random(100)+px,0);
  36. }
  37. }
  38. }
  39. .error:before {
  40. content: attr(data-text);
  41. position: absolute;
  42. left: -2px;
  43. text-shadow: 1px 0 $blue;
  44. top: 0;
  45. color: $gray-800;
  46. background: $gray-100;
  47. overflow: hidden;
  48. clip: rect(0,900px,0,0);
  49. animation: noise-anim-2 3s infinite linear alternate-reverse;
  50. }