Created
February 29, 2012 19:29
-
-
Save chriseppstein/1943798 to your computer and use it in GitHub Desktop.
This is code that runs using Sass 3.2 prerelease and something like this will be in compass soon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@include keyframes(appear-and-roundify) { | |
0% { opacity: 0; @include border-radius(2px); } | |
100% { opacity: 1; @include border-radius(10px); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@-moz-keyframes appear-and-roundify { 0% { opacity: 0; -moz-border-radius: 2px; border-radius: 2px; } | |
100% { opacity: 1; -moz-border-radius: 10px; border-radius: 10px; } } | |
@-webkit-keyframes appear-and-roundify { 0% { opacity: 0; -webkit-border-radius: 2px; border-radius: 2px; } | |
100% { opacity: 1; -webkit-border-radius: 10px; border-radius: 10px; } } | |
@-o-keyframes appear-and-roundify { 0% { opacity: 0; -o-border-radius: 2px; border-radius: 2px; } | |
100% { opacity: 1; -o-border-radius: 10px; border-radius: 10px; } } | |
@-ms-keyframes appear-and-roundify { 0% { opacity: 0; -ms-border-radius: 2px; border-radius: 2px; } | |
100% { opacity: 1; -ms-border-radius: 10px; border-radius: 10px; } } | |
@keyframes appear-and-roundify { 0% { opacity: 0; border-radius: 2px; } | |
100% { opacity: 1; border-radius: 10px; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin keyframes($name, | |
$moz: $experimental-support-for-mozilla, | |
$webkit: $experimental-support-for-webkit, | |
$o: $experimental-support-for-opera, | |
$ms: $experimental-support-for-microsoft, | |
$khtml: $experimental-support-for-khtml, | |
$official: true) | |
{ | |
@if $moz { | |
@include with-only-support-for($moz: true) { | |
@-moz-keyframes #{$name} { @content; } | |
} | |
} | |
@if $webkit { | |
@include with-only-support-for($webkit: true) { | |
@-webkit-keyframes #{$name} { @content; } | |
} | |
} | |
@if $o { | |
@include with-only-support-for($o: true) { | |
@-o-keyframes #{$name} { @content; } | |
} | |
} | |
@if $ms { | |
@include with-only-support-for($ms: true) { | |
@-ms-keyframes #{$name} { @content; } | |
} | |
} | |
@if $khtml { | |
@include with-only-support-for($khtml: true) { | |
@-khtml-keyframes #{$name} { @content; } | |
} | |
} | |
@if $official { | |
@include with-only-support-for { | |
@keyframes #{$name} { @content; } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin set-experimental-support($moz: false, $webkit: false, $ms: false, $o: false, $khtml: false) { | |
$experimental-support-for-mozilla: $moz; | |
$experimental-support-for-webkit: $webkit; | |
$experimental-support-for-microsoft: $ms; | |
$experimental-support-for-opera: $o; | |
$experimental-support-for-khtml: $khtml; | |
} | |
@mixin with-only-support-for($moz: false, $webkit: false, $ms: false, $o: false, $khtml: false) { | |
// Capture the current state | |
$original-moz: $experimental-support-for-mozilla; | |
$original-webkit: $experimental-support-for-webkit; | |
$original-o: $experimental-support-for-opera; | |
$original-ms: $experimental-support-for-microsoft; | |
$original-khtml: $experimental-support-for-khtml; | |
@include set-experimental-support($moz, $webkit, $ms, $o, $khtml); | |
@content; | |
@include set-experimental-support($original-moz, $original-webkit, $original-ms, $original-o, $original-khtml); | |
} |
@neekey Compass' documentation covers the latest stable version (0.12.2) whereas this feature is for 0.13, which is currently in alpha. Animations will be added to Compass and documented when 0.13 becomes the latest stable version. You can keep up-to-date with new versions of Compass here:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just want to know, when will this
mixin
become part of compass? As almost a year has passed, still don't find anything about animation from the document.