scss @HugoGiraudel的长影Sass Mixin http://www.sitepoint.com/ultimate-long-shadow-sass-mixin/

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss @HugoGiraudel的长影Sass Mixin http://www.sitepoint.com/ultimate-long-shadow-sass-mixin/相关的知识,希望对你有一定的参考价值。

@function long-shadow($direction, $length, $color, $fade: false, $shadow-count: 100) {
  $shadows: ();
  $conversion-map: (
    to top: 180deg,
    to top right: 135deg,
    to right top: 135deg,
    to right: 90deg,
    to bottom right: 45deg,
    to right bottom: 45deg,
    to bottom: 0deg,
    to bottom left: 315deg,
    to left bottom: 315deg,
    to left: 270deg,
    to left top: 225deg,
    to top left: 225deg
  );

  @if map-has-key($conversion-map, $direction) {
    $direction: map-get($conversion-map, $direction);
  }

  @for $i from 1 through $shadow-count {
    $current-step: ($i * $length / $shadow-count);
    $current-color: if(not $fade, $color, if(type-of($fade) == 'color',  mix($fade, $color, ($i / $shadow-count * 100)), rgba($color, 1 - $i / $shadow-count)));

    $shadows: append($shadows, (sin(0deg + $direction) * $current-step) (cos(0deg + $direction) * $current-step) 0 $current-color, 'comma');
  }

  @return $shadows;
}

以上是关于scss @HugoGiraudel的长影Sass Mixin http://www.sitepoint.com/ultimate-long-shadow-sass-mixin/的主要内容,如果未能解决你的问题,请参考以下文章

SASS优化响应式断点管理

sass和scss区别?

sass和scss

如何将scss转换成css文件

vue2.0以上版本安装sass(scss)

css、scss、sass 和 less 有啥区别? [复制]