Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. /**!
  2. * SCSS Modular scale function
  3. * Will use $ms-base as the scale, and $degrees to calculate stops on the scale
  4. *
  5. * @author Jason Howmans <@jhwmns>
  6. *
  7. * @examples
  8. * Usage example for font size:
  9. * // Using a scale of 1.4, this will output font-size: 1.96rem;
  10. * font-size: #{ms(2)}rem;
  11. *
  12. * Will also work with backward steps
  13. * // Using a scale of 1.4, this will output font-size: .714rem;
  14. * font-size: #{ms(-1)}rem;
  15. */
  16.  
  17. $ms-base: 1.4;
  18.  
  19. @function ms($degrees:1) {
  20. $num: 1;
  21. $isNegative: false;
  22. @if $degrees < 0 {
  23. $isNegative: true;
  24. $degrees: $degrees * -1;
  25. }
  26. @for $i from 1 through $degrees {
  27. @if $isNegative {
  28. $num: $num / $ms-base;
  29. } @else {
  30. $num: $num * $ms-base;
  31. }
  32. }
  33. @return round($num * 1000) / 1000; // round to three decimal places
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement