Skip to content

Instantly share code, notes, and snippets.

@Snugug
Created February 11, 2015 22:46
Show Gist options
  • Select an option

  • Save Snugug/605a65b9d4fe512c0730 to your computer and use it in GitHub Desktop.

Select an option

Save Snugug/605a65b9d4fe512c0730 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 animate($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 animate('fade-in');
@include animate('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