Skip to content

Instantly share code, notes, and snippets.

@una
Created February 11, 2015 22:52
Show Gist options
  • Save una/2b0ae7f4dcfdf0f006b1 to your computer and use it in GitHub Desktop.
Save una/2b0ae7f4dcfdf0f006b1 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="foo">
Hello World
</div>
// ----
// Sass (v3.4.11)
// Compass (v1.0.3)
// ----
$animations: (
'fade-in': (
0%: (
opacity: 0
),
100%: (
opacity: 1
)
),
'slide-in' : (
0%: (
transform: translateY(-100%)
),
100%: (
transform: translateY(0)
)
)
);
@mixin include-animation($name) {
@if map-has-key($animations, $name) {
@keyframes #{$name} {
@each $position, $change in map-get($animations, $name) {
#{$position} {
@each $prop, $val in $change {
#{$prop}: #{$val}
}
}
}
}
}
}
@include include-animation('fade-in');
@include include-animation('slide-in');
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes slide-in {
0% {
transform: translateY(-100%);
}
100% {
transform: translateY(0);
}
}
<div class="foo">
Hello World
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment