Created
April 7, 2014 22:50
-
-
Save jgillman/10070705 to your computer and use it in GitHub Desktop.
Native Sass mixin for CSS3 animation, no Compass needed.
This file contains hidden or 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
| // Choose what browser prefixes you want based on info you find here: | |
| // http://caniuse.com/#feat=css-animation | |
| // Add vendor prefixes to keyframes | |
| @mixin keyframes($animation-name) | |
| @-webkit-keyframes #{$animation-name} | |
| @content | |
| @-moz-keyframes #{$animation-name} | |
| @content | |
| @keyframes #{$animation-name} | |
| @content | |
| // Use syntax like you would with regular CSS animations. No need to limit what | |
| // animation options you can use or what what order to put the arguments in. | |
| // | |
| // Usage: @include animation(my-animation-name 0.6s linear infinite) | |
| @mixin animation ($animation) | |
| -webkit-animation: $animation | |
| -moz-animation: $animation | |
| animation: $animation |
This file contains hidden or 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
| // SCSS for the lazy. | |
| // Choose what browser prefixes you want based on info you find here: | |
| // http://caniuse.com/#feat=css-animation | |
| // Add vendor prefixes to keyframes | |
| @mixin keyframes($animation-name) { | |
| @-webkit-keyframes #{$animation-name} { | |
| @content; | |
| } | |
| @-moz-keyframes #{$animation-name} { | |
| @content; | |
| } | |
| @keyframes #{$animation-name} { | |
| @content; | |
| } | |
| } | |
| // Use syntax like you would with regular CSS animations. No need to limit what | |
| // animation options you can use or what what order to put the arguments in. | |
| // | |
| // Usage: @include animation(my-animation-name 0.6s linear infinite) | |
| @mixin animation($animation) { | |
| -webkit-animation: $animation; | |
| -moz-animation: $animation; | |
| animation: $animation; | |
| } |
This file contains hidden or 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( flash ) | |
| 0%, 100% | |
| background: #000 | |
| 50% | |
| background: #fff | |
| .element-to-be-flashed | |
| @include animation(flash 1.6s infinite linear) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment