Skip to content

Instantly share code, notes, and snippets.

@brimanning
Forked from Integralist/1. Example.scss
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brimanning/4534b76a095cce36c983 to your computer and use it in GitHub Desktop.
Save brimanning/4534b76a095cce36c983 to your computer and use it in GitHub Desktop.
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@include keyframe(changecolour) {
0% {
color: #000;
}
100% {
color: #FFF;
}
}
@mixin keyframe ($animation_name) {
@-webkit-keyframes $animation_name {
@content;
}
@-moz-keyframes $animation_name {
@content;
}
@-o-keyframes $animation_name {
@content;
}
@keyframes $animation_name {
@content;
}
}
/*
Example usage:
@include animation(changecolour, 10s)
@include animation(changecolour, 10s, linear, 5s)
*/
@mixin animation ($animation, $duration: 2s, $timing-function: ease, $delay: 0s, $iteration-count: 1, $direction: normal, $fill-mode: forwards) {
-webkit-animation: $animation $duration $timing-function $delay $iteration-count $direction $fill-mode;
-moz-animation: $animation $duration $timing-function $delay $iteration-count $direction $fill-mode;
-o-animation: $animation $duration $timing-function $delay $iteration-count $direction $fill-mode;
animation: $animation $duration $timing-function $delay $iteration-count $direction $fill-mode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment