Last active
January 16, 2017 17:58
-
-
Save celsowhite/7e3022b5eb528a03aa87220b2de67d63 to your computer and use it in GitHub Desktop.
Sass snippet for when you need to do the same keyframe animation for different elements but use different colors.
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
// Setup a map for the color variables. | |
$colorMap: (firstBlue: #297189, secondBlue: #BEEBEB, thirdBlue: #A2DAE0, fourthBlue: #81C4D4, fifthBlue: #5099AA); | |
// Loop through each to create the selector and keyframes function | |
@each $colorName, $color in $colorMap { | |
// Selector for this specific svg component. | |
.logo_transition.fill_#{$colorName} { | |
animation: fill_#{$colorName} 1s 1s linear forwards; | |
} | |
// Keyframes | |
@keyframes fill_#{$colorName} { | |
to { | |
fill: $color; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment