Skip to content

Instantly share code, notes, and snippets.

@cimmanon
Created February 2, 2016 13:34
Show Gist options
  • Save cimmanon/173837106037db9b1076 to your computer and use it in GitHub Desktop.
Save cimmanon/173837106037db9b1076 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.20)
// Compass (v1.0.3)
// ----
@function material-shadow($dp) {
$shadow : "0px ";
$ambientY : $dp;
// Calculate $ambientBlur
@if($dp == 1) {
$ambientBlur: 3
} @else {
$ambientBlur: $dp * 2;
}
$ambientAlpha : ($dp + 10 + ($dp / 9.38)) / 100;
// Calculate $directY
@if( $dp < 10 ) {
@if($dp % 2 == 0) {
$directY: $dp - (($dp / 2) - 1);
} @else {
$directY: $dp - (($dp - 1) / 2);
}
} @else {
$directY: $dp - 4;
}
// Calculate $directBlur
@if( $dp == 1 ) {
$directBlur: 3;
} @else {
$directBlur: $dp * 2;
}
$directAlpha: (24 - decimal-round($dp / 10)) / 100;
@return "0px " #{$ambientY} "px " #{$ambientBlur} "px rgba(0, 0, 0, " #{$ambientAlpha} "), 0px " #{$directY} "px " #{$directBlur} "px rgba(0, 0, 0, " #{$directAlpha} ")";
}
.foo {
bar: material-shadow(1px);
}
Undefined variable: "$ambientBlur".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment