Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**!
- * SCSS Modular scale function
- * Will use $ms-base as the scale, and $degrees to calculate stops on the scale
- *
- * @author Jason Howmans <@jhwmns>
- *
- * @examples
- * Usage example for font size:
- * // Using a scale of 1.4, this will output font-size: 1.96rem;
- * font-size: #{ms(2)}rem;
- *
- * Will also work with backward steps
- * // Using a scale of 1.4, this will output font-size: .714rem;
- * font-size: #{ms(-1)}rem;
- */
- $ms-base: 1.4;
- @function ms($degrees:1) {
- $num: 1;
- $isNegative: false;
- @if $degrees < 0 {
- $isNegative: true;
- $degrees: $degrees * -1;
- }
- @for $i from 1 through $degrees {
- @if $isNegative {
- $num: $num / $ms-base;
- } @else {
- $num: $num * $ms-base;
- }
- }
- @return round($num * 1000) / 1000; // round to three decimal places
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement