Created
March 17, 2018 09:26
-
-
Save simonhaenisch/df843aa97f70e500bcea279e06609654 to your computer and use it in GitHub Desktop.
Add transition mixin/function for Stylus
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
addTransition(props, duration = 300ms) | |
// examples: | |
// - addTransition(color) | |
// - addTransition(color, 1s) | |
// - addTransition('color, background-color') | |
// - addTransition('color, background-color', 500ms) | |
$parts = () | |
for prop in split(', ', props) | |
push($parts, prop) | |
will-change: unquote(join(', ', $parts)) | |
$parts = () | |
for prop in split(', ', props) | |
push($parts, (prop + ' ' + duration + ' ease')) | |
transition: unquote(join(', ', $parts)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment