Created
September 3, 2017 14:33
-
-
Save Allenice/f8d2d3a45b6ec75145f7a440e57ef6f7 to your computer and use it in GitHub Desktop.
folded-corner
This file contains 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
@mixin folded-corner($background, $size, $angle, 30deg) { | |
position: relative; | |
background: linear-gradient($angle - 180deg, transparent $size, $background, 0); | |
border-radius: .5em; | |
$x: $size / sin($angle); | |
$y: $size / cos($angle); | |
&::before { | |
content: ""; | |
position: absolute; | |
top: 0; | |
right: 0; | |
background: linear-gradient(to left bottom, transparent 50%, rgba(0,0,0,.2) 0, rgba(0,0,0,.4)) 100% 0 no-repeat); | |
width: $y; | |
height: $x; | |
transform: translateY($y - $x) rotate(2 * $angle - 90deg); | |
transform-origin: bottom right; | |
border-bottom-left-radius: inherit; | |
box-shadow: -.2em .2em .3em -.1em rgba(0, 0, 0, .2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sin / cos use mathsass: https://github.com/terkel/mathsass