Created
January 29, 2016 20:24
-
-
Save GreenGremlin/416e4b4ed094609a4440 to your computer and use it in GitHub Desktop.
Sass matrix rotation (doesn't quite work)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Matrix rotation version: | |
// this would work, except the y-axis is fliped for box-shadow | |
$m-0-degrees: ((1, 0), (0, 1)); | |
$m-90-degrees: ((0, 1), (-1, 0)); | |
$m-180-degrees: ((-1, 0), (0, -1)); | |
$m-270-degrees: ((0, -1), (1, 0)); | |
@function m-rotate($x, $y, $m) { | |
$m1: nth($m, 1); | |
$m2: nth($m, 2); | |
@return nth($m1, 1)*$x+nth($m1, 2)*$x nth($m2, 1)*$y+nth($m2, 2)*$y; | |
} | |
@mixin shadow-dots($mx, $color1, $color2, $size) { | |
box-shadow: | |
m-rotate(15px, 15px, $mx) red, | |
m-rotate(15px, -15px, $mx) blue, | |
m-rotate(-15px, -15px, $mx) green, | |
m-rotate(-15px, 15px, $mx) yellow; | |
} | |
@mixin shadow-dots($x, $y, $x2, $y2, $color1, $color2, $size) { | |
box-shadow: | |
($size*$x)+($size*$x2) ($size*$y)+($size*$y2) $color2, | |
($size*$x)+($size*$x2) ($size*$y*-1)+($size*$y2*-1) $color1, | |
($size*$x*-1)+($size*$x2*-1) ($size*$y*-1)+($size*$y2*-1) $color2, | |
($size*$x*-1)+($size*$x2*-1) ($size*$y)+($size*$y2) $color1; | |
} | |
@keyframes spin { | |
0%, 100% { | |
@include shadow-dots($m-0-degrees, $spinnerColor, $spinnerColor2, $spinnerSize); | |
} | |
25% { | |
@include shadow-dots($m-90-degrees, $spinnerColor2, $spinnerColor, $spinnerSize); | |
} | |
50% { | |
@include shadow-dots($m-180-degrees, $spinnerColor, $spinnerColor2, $spinnerSize); | |
} | |
75% { | |
@include shadow-dots($m-270-degrees, $spinnerColor2, $spinnerColor, $spinnerSize); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment