Created
August 19, 2013 16:07
-
-
Save quezo/6270833 to your computer and use it in GitHub Desktop.
A CodePen by Ana Tudor. Pastel triangle grid
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
-(1..63).each do |i| | |
.tri |
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
@import "compass"; | |
$l: 10em; | |
$a: pi()/3; | |
$h: $l*sin($a); | |
html { overflow: hidden; background: grey; } | |
body { margin: 0 $l/4; width: 4.5*$l; } | |
.tri { | |
$ra: $a/2; | |
$sa: pi()/2 - $a; | |
$sf: sin($a); | |
float: left; | |
overflow: hidden; | |
margin: ($h - $l)/2 (-$l/4); | |
width: $l; height: $l; | |
@for $i from 0 to 2 { | |
&:nth-child(2n + #{$i}) { | |
transform: translate(0, pow(-1, $i + 1)*$h/2) | |
rotate(#{$ra}rad) skewY(#{$sa}rad) scaleX($sf); | |
@for $j from 0 to 7 { | |
&:nth-child(7n + #{$j}) { | |
&:before { | |
background: hsl(($i*7 + $j)*360/14, 100%, 70%); | |
} | |
} | |
} | |
&:before { | |
transform: scaleX(1/$sf) skewY(#{-$sa}rad) | |
rotate(#{-$ra}rad) translateY(pow(-1, $i)*50%); | |
} | |
} | |
} | |
&:before { | |
display: block; | |
width: inherit; height: inherit; | |
content: ''; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment