_linear-angle-parser.scss 757 B

12345678910111213141516171819202122232425
  1. // Private function for linear-gradient-parser
  2. @function _linear-angle-parser($image, $first-val, $prefix, $suffix) {
  3. $offset: null;
  4. $unit-short: str-slice($first-val, str-length($first-val) - 2, str-length($first-val));
  5. $unit-long: str-slice($first-val, str-length($first-val) - 3, str-length($first-val));
  6. @if ($unit-long == "grad") or
  7. ($unit-long == "turn") {
  8. $offset: if($unit-long == "grad", -100grad * 3, -0.75turn);
  9. }
  10. @else if ($unit-short == "deg") or
  11. ($unit-short == "rad") {
  12. $offset: if($unit-short == "deg", -90 * 3, 1.6rad);
  13. }
  14. @if $offset {
  15. $num: _str-to-num($first-val);
  16. @return (
  17. webkit-image: -webkit- + $prefix + ($offset - $num) + $suffix,
  18. spec-image: $image
  19. );
  20. }
  21. }