Last active
August 29, 2015 14:15
-
-
Save mndvns/b12a4bc080592a532b60 to your computer and use it in GitHub Desktop.
Composable animations with ESS
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
| @-webkit-keyframes thing { | |
| html 0% { | |
| opacity: 0 | |
| } | |
| html 0% { | |
| background: black; | |
| } | |
| html 100% { | |
| opacity: 1 | |
| } | |
| html 100% { | |
| background: white; | |
| } | |
| } | |
| @keyframes thing { | |
| html 0% { | |
| opacity: 0 | |
| } | |
| html 0% { | |
| background: black; | |
| } | |
| html 100% { | |
| opacity: 1 | |
| } | |
| html 100% { | |
| background: white; | |
| } | |
| } |
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
| // a clean and composable interface | |
| html | |
| FadeIn | |
| block start | |
| background black | |
| block end | |
| background white | |
| // a fading animation with hooks | |
| function FadeIn(opts) | |
| Keyframe(name='thing') | |
| 0% | |
| opacity 0 | |
| = opts.start | |
| 100% | |
| opacity 1 | |
| = opts.end | |
| // vendor-prefixed constructor | |
| function Keyframe(opts) | |
| `'@-webkit-keyframes ' + opts.name` | |
| = opts.children | |
| `'@keyframes ' + opts.name` | |
| = opts.children |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment