Last active
March 19, 2017 15:15
-
-
Save Deifinger/efa19e8e33c31345d5793c83be3f3ad7 to your computer and use it in GitHub Desktop.
scss functions
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
/* | |
* Makes list of transitions in one property | |
* | |
* Example: | |
* transition: transitions((0: color, 1: opacity )); // returns transition:color .3s ease-in 0,opacity .3s ease-in 0 | |
*/ | |
@function transitions($properties: (0: all), $durations: (0: .3s), $timing-functions: (0: ease-in), $delays: (0: 0s)) { | |
$props: (( | |
'def': .3s, | |
'list': $durations | |
), ( | |
'def': ease-in, | |
'list': $timing-functions | |
), ( | |
'def': 0s, | |
'list': $delays | |
)); | |
$result: ""; | |
@each $name, $value in $properties { | |
$result: $result + " " + $value; | |
@each $prop in $props { | |
$val: null; | |
@if map-has-key($prop, $name) { | |
$list: map_get($prop, 'list'); | |
$val: map_get($list, $name); | |
} @else { | |
$val: map_get($prop, 'def'); | |
} | |
$result: $result + " " + $val; | |
} | |
$result: $result + ","; | |
} | |
@return #{$result}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment