Skip to content

Instantly share code, notes, and snippets.

@JoeNoPhoto
Last active October 14, 2015 07:10
Show Gist options
  • Save JoeNoPhoto/ef09ffce536f1796b461 to your computer and use it in GitHub Desktop.
Save JoeNoPhoto/ef09ffce536f1796b461 to your computer and use it in GitHub Desktop.
Animations and Keyframes Mixin
@mixin keyframes($animation-name) {
@-webkit-keyframes $animation-name {
@content;
}
@-moz-keyframes $animation-name {
@content;
}
@-ms-keyframes $animation-name {
@content;
}
@-o-keyframes $animation-name {
@content;
}
@keyframes $animation-name {
@content;
}
}
@mixin animation($str) {
-webkit-animation: #{$str};
-moz-animation: #{$str};
-ms-animation: #{$str};
-o-animation: #{$str};
animation: #{$str};
}
@JoeNoPhoto
Copy link
Author

Usage

@include keyframes(slide-down) {
  0% { opacity: 1; }
  90% { opacity: 0; }
}

.element {
  width: 100px;
  height: 100px;
  background: black;
  @include animation('slide-down 5s 3');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment