Last active
February 15, 2019 15:27
-
-
Save jbenner-radham/ecde9fa469d84ec70ebb6aaa90abb4a4 to your computer and use it in GitHub Desktop.
SCSS scratch file.
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
| @function make-long-shadow($color, $recursions: 200) { | |
| $shadows: 0 0 $color; | |
| @for $i from 1 through $recursions { | |
| $shadows: $shadows, #{$i}px #{$i}px #{$color}; | |
| } | |
| @return $shadows; | |
| } | |
| @function map($list, $callback, $args...) { | |
| @if not function-exists($callback) { | |
| @error 'A required callback function was not provided.'; | |
| } | |
| $mapped: (); | |
| @each $item in $list { | |
| $mapped: append($mapped, call($callback, $item, $args...)); | |
| } | |
| @return $mapped; | |
| } | |
| @function range($start: 1, $end: null) { | |
| $list: (); | |
| @if type-of($end) == number { | |
| @for $n from $start through $end { | |
| $list: append($list, $n); | |
| } | |
| @return $list; | |
| } | |
| $end: $start; | |
| @for $n from 1 through $end { | |
| $list: append($list, $n); | |
| } | |
| @return $list; | |
| } | |
| @function separate($list: (), $separator: auto) { | |
| $separated: (); | |
| @each $item in $list { | |
| $separated: append($separated, $item, $separator); | |
| } | |
| @return $separated; | |
| } | |
| @function _shadow($px, $color) { | |
| @return #{$px}px #{$px}px #{$color}; | |
| } | |
| @function long-shadow($color, $recursions: 355) { | |
| $shadows: map(range($recursions), _shadow, $color); | |
| @return separate($shadows, $separator: comma); | |
| } | |
| @function pow($base, $exponent) { | |
| @return abs($base) * $exponent; | |
| } | |
| @function square($n) { | |
| @return call(pow, $n, $n); | |
| } | |
| body { | |
| align-items: center; | |
| background-color: lighten(#ff0000, 5%); | |
| display: flex; | |
| height: 100vh; | |
| justify-content: center; | |
| } | |
| h1 { | |
| $text-color: #fefefe; | |
| $text-shadow: long-shadow(darken(#ff0000, 15%)); | |
| @for $i from 1 through 2 { | |
| $darkened: darken($text-color, 75%); | |
| $text-shadow: set-nth($text-shadow, $i, _shadow($i, $darkened)); | |
| } | |
| color: $text-color; | |
| font-family: sans-serif; | |
| font-size: 5.5rem; | |
| text-shadow: $text-shadow; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment