Last active
August 29, 2015 14:18
-
-
Save AllThingsSmitty/a24fdd020563f7a0454e to your computer and use it in GitHub Desktop.
Simplify animation keyframes with unique-id()
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
// Using the unique-id() function with a simple mixin you only have to provide keyframe values, not names | |
@mixin animation-keyframes { | |
$animation-name: unique-id(); | |
animation-name: $animation-name; | |
@keyframes #{$animation-name} { | |
@content; | |
} | |
} | |
.some-element { | |
animation: 10s linear infinite; | |
@include animation-keyframes { | |
from { | |
background-position: 0% 0%; | |
} | |
to { | |
background-position: 114.2857% 0%; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment