Skip to content

Instantly share code, notes, and snippets.

@doctyper
Created January 20, 2012 01:07
Show Gist options
  • Save doctyper/1644192 to your computer and use it in GitHub Desktop.
Save doctyper/1644192 to your computer and use it in GitHub Desktop.
Just some animation SCSS mixins.
@mixin animation($animation, $animation-2: none, $animation-3: none) {
@each $prefix in webkit, moz, ms {
#{""}-#{$prefix}-animation: $animation, $animation-2, $animation-3;
}
}
@mixin animation-name($name) {
@include experimental(animation-name, $name);
}
@mixin animation-duration($duration) {
@include experimental(animation-duration, $duration);
}
@mixin animation-delay($delay) {
@include experimental(animation-delay, $delay);
}
@potench
Copy link

potench commented Jan 20, 2012

@mixin animation($name, $length:1000ms, $ease:ease, $delay:0ms, $iteration:1, $alternate:normal, $fillmode:both, $backface:hidden) {
-webkit-animation-name: $name;
-webkit-animation-duration:$length;
-webkit-animation-iteration-count: $iteration;
-webkit-animation-timing-function: $ease;
-webkit-animation-delay: $delay;
-webkit-animation-direction: $alternate;
-webkit-animation-fill-mode: $fillmode;
-webkit-backface-visibility: $backface;

-moz-animation-name: $name;
-moz-animation-duration:$length;
-moz-animation-iteration-count: $iteration;
-moz-animation-timing-function: $ease;
-moz-animation-delay: $delay;
-moz-animation-direction: $alternate;
-moz-animation-fill-mode: $fillmode;

-ms-animation-name: $name;
-ms-animation-duration:$length;
-ms-animation-iteration-count: $iteration;
-ms-animation-timing-function: $ease;
-ms-animation-delay: $delay;
-ms-animation-direction: $alternate;
-ms-animation-fill-mode: $fillmode;
-ms-backface-visibility: $backface;

-o-animation-name: $name;
-o-animation-duration:$length;
-o-animation-iteration-count: $iteration;
-o-animation-timing-function: $ease;
-o-animation-delay: $delay;
-o-animation-direction: $alternate;
-o-animation-fill-mode: $fillmode;
-o-backface-visibility: $backface;

animation-name: $name;
animation-duration:$length;
animation-iteration-count: $iteration;
animation-timing-function: $ease;
animation-delay: $delay;
animation-direction: $alternate;
animation-fill-mode: $fillmode;
backface-visibility: $backface;

// enables hardware acceleration
-webkit-transform: translateZ(0);
-moz-animation: translateZ(0);
-ms-animation: translateZ(0);
-o-animation: translateZ(0);
animation: translateZ(0);

}

@dlo
Copy link

dlo commented Aug 24, 2012

Hey guys! Fancy seeing you here :)

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