Skip to content

Instantly share code, notes, and snippets.

@lunelson
Created October 28, 2013 19:27
Show Gist options
  • Save lunelson/7203024 to your computer and use it in GitHub Desktop.
Save lunelson/7203024 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
$animation-data: (
fadeIn: (
from: (
opacity: 0
),
to: (
opacity: 1
)
),
fadeOut: (
from: (
opacity: 1
),
to: (
opacity: 0,
transform: (translateX(5rem), translateY(2rem)),
)
),
zoomOut: (
0%: (
transform: (scaleX(100%), scaleY(100%))
),
100%: (
transform: (scaleX(0%), scaleY(0%))
)
)
);
@mixin animation-setup($names...) {
@each $name in $names {
$spec: map-get($animation-data, $name);
@keyframes #{$name} {
@each $keyframe, $declaration in $spec {
#{$keyframe} {
@each $property, $value in $declaration {
#{$property}: $value;
}
}
}
}
.animated.#{$name} {
animation-name: $name;
}
}
}
@include animation-setup(fadeIn, fadeOut, zoomOut);
@keyframes fadeIn { from { opacity: 0; }
to { opacity: 1; } }
.animated.fadeIn { animation-name: fadeIn; }
@keyframes fadeOut { from { opacity: 1; }
to { opacity: 0; transform: translateX(5rem), translateY(2rem); } }
.animated.fadeOut { animation-name: fadeOut; }
@keyframes zoomOut { 0% { transform: scaleX(100%), scaleY(100%); }
100% { transform: scaleX(0%), scaleY(0%); } }
.animated.zoomOut { animation-name: zoomOut; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment