scss 来自http://www.sitepoint.com/ultimate-long-shadow-sass-mixin/

Posted

tags:

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

/* #Long Shdows Mixin 

<http://www.sitepoint.com/ultimate-long-shadow-sass-mixin/>

@mixin - long-shadow
@author - H. Giraudel
$direction 
$lengh
$color
$fade
$shadow-count

Styleguide mixins.long-shadow
*/
@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 来自http://www.sitepoint.com/ultimate-long-shadow-sass-mixin/的主要内容,如果未能解决你的问题,请参考以下文章

scss 来自TaroUI的Mixins

scss 来自TaroUI的常见主题变量

scss 块网格(来自Zurb Foundation)

scss 来自网络的Handy Sass资源

来自util.js的Angular 6 SCSS编译错误

scss 来自Foundation(Zurb)的Flex Video Mixin的修改版本https://github.com/zurb/foundation/blob/master/scss/fou